Skip to content

Commit 8089d45

Browse files
authored
Merge pull request neetcode-gh#932 from ctrl-alt-caleb/patch-1
Create 190-Reverse-Bits.cs
2 parents 1d0a362 + d3e6c2a commit 8089d45

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

csharp/190-Reverse-Bits.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class Solution
2+
{
3+
public uint reverseBits(uint n)
4+
{
5+
uint result = 0;
6+
for (int i = 0; i < 32; i++)
7+
{
8+
uint temp = (n & 1);
9+
result = (result << 1) + temp;
10+
n >>= 1;
11+
}
12+
return result;
13+
}
14+
}

0 commit comments

Comments
 (0)