Data structures & algorithms
Find the element that appears only once when all others appear twice using XOR
Count the number of set bits (1s) in a binary number (Hamming Weight)
Return array where ans[i] is the number of 1s in binary of i
Reverse bits of a 32-bit unsigned integer
Find the missing number in array [0, n] using XOR
Check if a number is a power of two
Add two integers without using + or - operators
Find element appearing once when others appear 3 times
Find two elements appearing once when others appear twice
Find bitwise AND of all numbers in range [left, right]
Flip all bits in binary representation
Check if a number is a power of four
Check if binary has alternating bits (101010...)
Count differing bit positions between two numbers
Find maximum XOR of any two numbers in array
Find two numbers in a sorted array that add up to target
Check if string is palindrome (ignoring non-alphanumeric)
Reverse array of characters in-place using two pointers
Remove duplicates from sorted array in-place, return new length
Move all zeroes to end while maintaining order of non-zero elements
Return squares of sorted array in sorted order (handles negatives)
Find two lines that form container holding most water
Find all unique triplets that sum to zero
Sort array of 0s, 1s, 2s in-place using three pointers
Remove all instances of value in-place, return new length
Check if s is a subsequence of t
Merge two sorted arrays into first array in-place
Partition string so each letter appears in at most one part
Calculate how much rain water can be trapped between bars
Find three integers whose sum is closest to target
Find two numbers that add up to target using hash map
Check if array contains any duplicate values using Set
Check if two strings are anagrams using character frequency
Group strings that are anagrams of each other
Find the k most frequent elements using bucket sort
Calculate product of all elements except self without division
Find length of longest consecutive sequence in O(n)
Find maximum profit from one buy and one sell
Find contiguous subarray with largest sum using Kadane algorithm
Find element appearing more than n/2 times using Boyer-Moore