Pattern
Bit Manipulation
A compact view of archive entries grouped by recurring technique.
74 entries
74 entries tagged as Bit Manipulation.
09.04.2026
hard3655. XOR After Range Multiplication Queries II
Run stepped multiplication queries
08.04.2026
medium3653. XOR After Range Multiplication Queries I
Run queries
08.03.2026
medium1980. Find Unique Binary String
Uniq bits not in a set
07.03.2026
medium1888. Minimum Number of Flips to Make the Binary String Alternating
Min flips to make 01 alterating string sum window
05.03.2026
easy1758. Minimum Changes To Make Alternating Binary String
Min flips to make bits alterating
03.03.2026
medium1545. Find Kth Bit in Nth Binary String
Kth bit in s=s+1+inv(rev(s)) sequence
27.02.2026
hard3666. Minimum Operations to Equalize Binary String
Min steps to convert 01 stirng to ones flipping K
25.02.2026
easy1356. Sort Integers by The Number of 1 Bits
Sort
21.02.2026
easy762. Prime Number of Set Bits in Binary Representation
Number in l..r with prime bits count
18.02.2026
easy693. Binary Number with Alternating Bits
Alternating bits
17.02.2026
easy401. Binary Watch
All times with count bits set
16.02.2026
easy190. Reverse Bits
Reverse bits
21.01.2026
medium3315. Construct the Minimum Bitwise Array II
Reverse operation x or (x+1)
20.01.2026
easy3314. Construct the Minimum Bitwise Array I
Reverse x | (x+1) operation on prime numbers
18.11.2025
easy717. 1-bit and 2-bit Characters
Is '0' last from characters '0','10','11' concatenation
08.11.2025
hard1611. Minimum One Bit Operations to Make Integers Zero
Min steps to make zero by xor 1 or xor rightmost+1
31.10.2025
easy3289. The Two Sneaky Numbers of Digitville
Two extra numbers from 0..n
29.10.2025
easyWith All Set Bits
Next all bits set number
15.08.2025
easy342. Power of Four
Is number power of 4?
11.08.2025
medium2438. Range Product Queries of Powers
Range product queries of powers of two from n
10.08.2025
medium869. Reordered Power of 2
Rearrange digits to make power of two
9.08.2025
easy231. Power of Two
Is int 32 power of 2?
31.07.2025
medium898. Bitwise ORs of Subarrays
Uniq OR-subarrays
29.07.2025
medium2411. Smallest Subarrays With Maximum Bitwise OR
Shortest max OR i.. subarrays pointers
28.07.2025
medium2044. Count Number of Maximum Bitwise-OR Subsets
Subsequencies with max OR
24.07.2025
hard2322. Minimum Score After Removals on a Tree
Min(max group xor - min group xor) by removing 2 edges from tree
4.07.2025
hard3307. Find the K-th Character in String Game II
kth char in double+shift by ops[i] string manipulation
06.05.2025
easy1920. Build Array from Permutation
n[n[i]]
15.04.2025
hard2179. Count Good Triplets in an Array
Triplets in same order in both (0..n)-arrays
05.04.2025
easy1863. Sum of All Subset XOR Totals
Sum of all subsets xors
20.03.2025
hard3108. Minimum Cost Walk in Weighted Graph
Min AND of path weights manipulation
19.03.2025
medium3191. Minimum Operations to Make Binary Array Elements Equal to One I
bits flips to make all 1 manipulation
18.03.2025
medium2401. Longest Nice Subarray
Max window of all pairs AND zero pointers manipulation
17.03.2025
easy2206. Divide Array Into Equal Pairs
All numbers in pairs
17.01.2025
medium2683. Neighboring Bitwise XOR
Can restore next-sibl-xored array?
16.01.2025
medium2425. Bitwise XOR of All Pairings
Xor of all pairs xors
15.01.2025
medium2429. Minimize XOR
Min xor with num1, bits count of num2
22.11.2024
medium1072. Flip Columns For Maximum Number of Equal Rows
Max same-bit-rows after flipping columns in 01-2D matrix
10.11.2024
medium3097. Shortest Subarray With OR at Least K II
Min subarray with OR[..] >= k manipulation window
09.11.2024
medium3133. Minimum Array End
nth of increasing sequence with AND[..]=x manipulation
08.11.2024
medium1829. Maximum XOR for Each Query
Running xor to make 2^k-1 manipulation
07.11.2024
medium2275. Largest Combination With Bitwise AND Greater Than Zero
Max positive AND-subset manipulation
06.11.2024
medium3011. Find if Array Can Be Sorted
Can array be sorted by adjacent swap same-1-bits-nums
05.11.2024
medium2914. Minimum Number of Changes to Make Binary String Beautiful
Min changes to make even-sized 0 and 1
19.10.2024
medium1545. Find Kth Bit in Nth Binary String
kth bit of sequence bs[i] = bs[i-1] + '1' + rev(inv(bs[i-1])) manipulation
18.10.2024
medium2044. Count Number of Maximum Bitwise-OR Subsets
Count subsequences with max bitwise or
15.09.2024
medium1371. Find the Longest Substring Containing Vowels in Even Counts
Longest substring with even number of "aeiou" manipulation pointers
14.09.2024
medium2419. Longest Subarray With Maximum Bitwise AND
Max bitwise AND subarray manipulation pointers
13.09.2024
medium1310. XOR Queries of a Subarray
Run queries[[from, to]] of xor(arr[from..to]) manipulation
11.09.2024
easy2220. Minimum Bit Flips to Convert Number
Bit diff between two numbers manipulation
22.08.2024
easy476. Number Complement
Invert bits: 101 becomes 010 manipulation
02.08.2024
medium2134. Minimum Swaps to Group All 1's Together II
Min swaps to make a circular [01] array window
24.06.2024
medium995. Minimum Number of K Consecutive Bit Flips
Count k-range flips in binary array to make all 1 window
31.05.2024
medium260. Single Number III
Two not duplicated numbers from array manipulation
30.05.2024
medium1442. Count Triplets That Can Form Two Arrays of Equal XOR
Number (i,j,k) where xor arr[i..j] = xor arr[j..k] manipulation
20.05.2024
easy1863. Sum of All Subset XOR Totals
Sum of subsets xors
13.05.2024
medium861. Score After Flipping Matrix
Max binary-row sum after toggling rows and columns
30.04.2024
medium1915. Number of Wonderful Substrings
Count substrings with at most one odd frequency manipulation
29.04.2024
medium2997. Minimum Number of Operations to Make Array XOR Equal to K
Bit diff between k and nums xor manipulation
20.02.2024
easy268. Missing Number
Missing in [0..n] number.
19.02.2024
easy231. Power of Two
Is number 2^x?
22.01.2024
easy645. Set Mismatch
Return missing and duplicated number in 1..n array with one number replaced.
30.11.2023
hard1611. Minimum One Bit Operations to Make Integers Zero
Minimum rounds of inverting rightmost bit or left of the rightmost 1 bit to make n zero
29.11.2023
easy191. Number of 1 Bits
Bits count
31.10.2023
medium2433. Find The Original Array of Prefix Xor
Reverse xor operation
30.10.2023
easy1356. Sort Integers by The Number of 1 Bits
Sort an array comparing by bit count and value
23.10.2023
easy342. Power of Four
Is n == x^4?
1.09.2023
easy338. Counting Bits
Array of bits count for numbers 0..n
01.08.2023
medium77. Combinations
All combinations choosing k numbers from 1..n numbers
24.07.2023
medium50. Pow(x, n)
x^n
4.07.2023
medium137. Single Number II
Let's use fold.
29.06.2023
hard864. Shortest Path to Get All Keys
Min steps to collect all lowercase keys in matrix. # and uppercase locks are blockers.
07.06.2023
medium1318. Minimum Flips to Make a OR b Equal to c
Minimum a and b Int bit flips to make a or b == c.
04.04.2023
medium2405. Optimal Partition of String
use hashset, [26] array or simple 32-bit mask to store visited flags for character