Skip to content

Commit

Permalink
Added flipping bits solution (hackerrank)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidb committed May 7, 2020
1 parent 9f53348 commit deaebc8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions hackerrank/easy-flipping-bits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Flipping bits (HackerRank)
===============================
### Easy
![Problem Statement](./pdfs/flipping-bits-English.pdf)

Solution
========
```python
#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the flippingBits function below.
def flippingBits(n):
max_int = 0xFFFFFFFF
return max_int - n

if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

q = int(input())

for q_itr in range(q):
n = int(input())

result = flippingBits(n)

fptr.write(str(result) + '\n')

fptr.close()

```

Binary file added hackerrank/pdfs/flipping-bits-English.pdf
Binary file not shown.

0 comments on commit deaebc8

Please sign in to comment.