Skip to content

Commit 491f4d6

Browse files
authored
Create closest-node-to-path-in-tree.cpp
1 parent 371f571 commit 491f4d6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

C++/closest-node-to-path-in-tree.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Time: O(n)
2+
// Space: O(1)
3+
4+
// string
5+
class Solution {
6+
public:
7+
int percentageLetter(string s, char letter) {
8+
return 100 * count(cbegin(s), cend(s), letter) / size(s);
9+
}
10+
};

0 commit comments

Comments
 (0)