Posts with tag 'bit manipulation'

Bitwise AND of Range of Numbers

less than 1 minute read

Given two integers start and end, return the bitwise AND of all numbers in [start, end], inclusive.

XOR Range Queries

1 minute read

You are given a list of integers nums and a two-dimensional list of integers queries. Each element in queries contains [i, j] and asks what is the value of n...

Lone Integer

less than 1 minute read

You are given a list of integers nums where each integer occurs exactly three times except for one which occurs once. Return the lone integer.

Number of Bits

less than 1 minute read

Given an integer n, return the number of 1 bits in n.

Hamming Distance

less than 1 minute read

Given two integers x, and y return the number of positions where their values differ in their binary representations as a 32-bit integer.

Check Power of Two

less than 1 minute read

Given an integer n greater than or equal to 0, return whether it is a power of two.

Back to top ↑