Skip to content

Commit a6d3f2c

Browse files
committed
add 172 folder & cpp, add 190 folder & cpp, add 434 folder & cpp
1 parent 7b28292 commit a6d3f2c

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public:
3+
int trailingZeroes(int n) {
4+
int cnt5 = 0 ;
5+
for (long long i = 5; i <= n; i *= 5)
6+
cnt5 += n/i ;
7+
return cnt5 ;
8+
}
9+
};
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
public:
3+
uint32_t reverseBits(uint32_t n) {
4+
uint32_t res = 0 ;
5+
uint32_t tmp = 1 << 31 ;
6+
while (n)
7+
{
8+
if (n&1)
9+
res |= tmp ;
10+
tmp >>= 1 ;
11+
n >>= 1 ;
12+
}
13+
14+
return res ;
15+
}
16+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public:
3+
int countSegments(string s) {
4+
if (s.length() < 1)
5+
return 0 ;
6+
7+
int cnt = isspace(s[0])? 0: 1 ;
8+
for (int i = 1; i < s.length(); ++i)
9+
if (!isspace(s[i]) && isspace(s[i-1]))
10+
++cnt ;
11+
return cnt ;
12+
}
13+
};

0 commit comments

Comments
 (0)