Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b79d400

Browse files
Merge pull request #28 from zouwx2cs/master
add 172 folder & cpp, add 190 folder & cpp, add 434 folder & cpp
2 parents f1e9a61 + a6d3f2c commit b79d400

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 9 additions & 0 deletions
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+
};
Lines changed: 16 additions & 0 deletions
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+
};
Lines changed: 13 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /