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
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. ...
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)....
65 views

123 views

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 ...
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 ...