People who code: we want your input. Take the Survey

# Questions tagged [bit-manipulation]

The tag has no usage guidance.

73 questions
Filter by
Sorted by
Tagged with
2answers
1k views

### Converting a number from N to 0 in binary

Trying to solve this problem since 2 days. Still unable to figure out even a basic approach. Given a number $N$ in binary ($1$ to $10^5$), we need to convert it to $0$ using only 2 operations. ...
1answer
48 views

### Is the following Greedy algorithm to generate Gray Codes always correct?

I recently solved the basic problem of generating a n-bit Gray Code. The solution I used involved building larger-bit Gray Codes from smaller ones recursively (the solution I've seen on most websites)....
1answer
65 views

1answer
123 views

1answer
81 views

### find maximum sum of xors

we are given an Array Array size <= 10^4 . 0 <= A[i] <= 15 We need to partition the array into 4 subsets (each subset can have zero or more elements ). Take xor of each subset and sum ...
1answer
48 views

### Maximize AND on a sequence of XORs

Problem We are given 2 arrays a and b both of length n. We build a third array ...
2answers
31 views

1answer
1k views

### ip/tcp packet decoding without wireshark

How can we manually read and interpret packets properly without using wireshark? Now from the Ethernet header I know that the Destination MAC Address should be at the 5th byte (after converting bits/...