Bit Manipulation LeetCode Problems A collection of LeetCode problems solved using Bit Manipulation pattern techniques, explanations, and complexity analysis. Problems Easy # Problem Language Time Space Explanation 191 Number of 1 Bits JavaScript, Python O(n) O(1) Explanation 342 Power of Four Python O(n) O(1) Explanation 461 Hamming Distance Python O(n) O(1) Explanation 598 Range Addition II Python O(n) O(1) Explanation 645 Set Mismatch TypeScript O(n) O(1) Explanation 682 Baseball Game Python O(n) O(1) Explanation 908 Smallest Range I Python O(n) O(1) Explanation 1137 N-th Tribonacci Number JavaScript, Python O(n) O(1) Explanation 1175 Prime Arrangements Python O(n) O(1) Explanation 1317 Convert Integer to the Sum of Two No-Zero Integers Python O(n) O(1) Explanation 1486 XOR Operation in an Array Python O(n) O(1) Explanation 1656 Design an Ordered Stream C++ O(n) O(1) Explanation 1720 Decode XORed Array C++ O(n) O(1) Explanation 1784 Check if Binary String Has at Most One Segment of Ones C++ O(n) O(1) Explanation 1805 Number of Different Integers in a String C++ O(n) O(1) Explanation 1903 Largest Odd Number in String C++ O(n) O(1) Explanation 1984 Minimum Difference Between Highest and Lowest of K Scores JavaScript O(n) O(1) Explanation 2094 Finding 3-Digit Even Numbers Python O(n) O(1) Explanation 2169 Count Operations to Obtain Zero Python O(n) O(1) Explanation 2220 Minimum Bit Flips to Convert Number Python O(n) O(1) Explanation 2269 Find the K-Beauty of a Number Python O(n) O(1) Explanation 2283 Check if Number Has Equal Digit Count and Digit Value Python O(n) O(1) Explanation 2379 Minimum Recolors to Get K Consecutive Black Blocks Python O(n) O(1) Explanation 2614 Prime In Diagonal Python O(n) O(1) Explanation 2723 Add Two Promises TypeScript O(n) O(1) Explanation 2859 Sum of Values at Indices With K Set Bits Python O(n) O(1) Explanation 2864 Maximum Odd Binary Number JavaScript O(n) O(1) Explanation 2880 Select Data Python O(n) O(1) Explanation 2883 Drop Missing Data Python O(n) O(1) Explanation 2886 Change Data Type Python O(n) O(1) Explanation 2887 Fill Missing Data Python O(n) O(1) Explanation 2917 Find the K-or of an Array Python O(n) O(1) Explanation 2932 Maximum Strong Pair XOR I Python O(n) O(1) Explanation 2974 Minimum Number Game JavaScript O(n) O(1) Explanation 3095 Shortest Subarray With OR at Least K I Python O(n) O(1) Explanation 3168 Minimum Number of Chairs in a Waiting Room JavaScript O(n) O(1) Explanation 3206 Alternating Groups I Python O(n) O(1) Explanation 3226 Number of Bit Changes to Make Two Integers Equal Python O(n) O(1) Explanation 3314 Construct the Minimum Bitwise Array I Python O(n) O(1) Explanation 3402 Minimum Operations to Make Columns Strictly Increasing Python O(n) O(1) Explanation 3674 Minimum Operations to Equalize Array Python O(n) O(1) Explanation 3688 Bitwise OR of Even Numbers in an Array Python O(n) O(1) Explanation 3701 Compute Alternating Sum Python O(n) O(1) Explanation 3726 Remove Zeros in Decimal Representation Python O(n) O(1) Explanation 3750 Minimum Number of Flips to Reverse Binary String Python O(n) O(1) Explanation 3827 Count Monobit Integers Python O(n) O(1) Explanation 3950 Exactly One Consecutive Set Bits Pair Python O(n) O(1) Explanation 3954 Sum of Compatible Numbers in Range I Python O(n) O(1) Explanation Medium # Problem Language Time Space Explanation 8 String to Integer (atoi) Python O(n) O(1) Explanation 89 Gray Code JavaScript, Python O(n) O(1) Explanation 137 Single Number II JavaScript, Python O(n) O(1) Explanation 152 Maximum Product Subarray Python O(n) O(1) Explanation 172 Factorial Trailing Zeroes JavaScript, Python O(n) O(1) Explanation 238 Product of Array Except Self JavaScript, Python O(n) O(1) Explanation 260 Single Number III Python O(n) O(1) Explanation 393 UTF-8 Validation Python O(n) O(1) Explanation 396 Rotate Function C++ O(n) O(1) Explanation 421 Maximum XOR of Two Numbers in an Array Python O(n) O(1) Explanation 452 Minimum Number of Arrows to Burst Balloons JavaScript O(n) O(1) Explanation 453 Minimum Moves to Equal Array Elements Python O(n) O(1) Explanation 462 Minimum Moves to Equal Array Elements II Python O(n) O(1) Explanation 477 Total Hamming Distance Python O(n) O(1) Explanation 592 Fraction Addition and Subtraction Python O(n) O(1) Explanation 835 Image Overlap JavaScript O(n²) O(1) Explanation 898 Bitwise ORs of Subarrays Python O(n) O(1) Explanation 973 K Closest Points to Origin Python O(n) O(1) Explanation 1310 XOR Queries of a Subarray Python O(n) O(1) Explanation 1352 Product of the Last K Numbers Python O(n) O(1) Explanation 1371 Find the Longest Substring Containing Vowels in Even Counts Python O(n) O(1) Explanation 1404 Number of Steps to Reduce a Number in Binary Representation to One Python O(n) O(1) Explanation 1419 Minimum Number of Frogs Croaking Python O(n) O(1) Explanation 1471 The k Strongest Values in an Array JavaScript O(n) O(1) Explanation 1529 Minimum Suffix Flips Python O(n) O(1) Explanation 1562 Find Latest Group of Size M Python O(n) O(1) Explanation 1680 Concatenation of Consecutive Binary Numbers Python O(n) O(1) Explanation 1689 Partitioning Into Minimum Number Of Deci-Binary Numbers Python O(n) O(1) Explanation 1737 Change Minimum Characters to Satisfy One of Three Conditions Python O(n) O(1) Explanation 1781 Sum of Beauty of All Substrings Python O(n) O(1) Explanation 1813 Sentence Similarity III Python O(n) O(1) Explanation 1829 Maximum XOR for Each Query Java O(n) O(1) Explanation 1860 Incremental Memory Leak Python O(n) O(1) Explanation 1864 Minimum Number of Swaps to Make the Binary String Alternating Python O(n) O(1) Explanation 1969 Minimum Non-Zero Product of the Array Elements Python O(n) O(1) Explanation 2063 Vowels of All Substrings JavaScript O(n) O(1) Explanation 2126 Destroying Asteroids Java O(n) O(1) Explanation 2166 Design Bitset JavaScript O(n) O(1) Explanation 2171 Removing Minimum Number of Magic Beans Python O(n) O(1) Explanation 2336 Smallest Number in Infinite Set JavaScript O(n) O(1) Explanation 2401 Longest Nice Subarray Python O(n) O(1) Explanation 2411 Smallest Subarrays With Maximum Bitwise OR Python O(n) O(1) Explanation 2419 Longest Subarray With Maximum Bitwise AND Python O(n) O(1) Explanation 2425 Bitwise XOR of All Pairings Python O(n) O(1) Explanation 2527 Find Xor-Beauty of Array Python O(n) O(1) Explanation 2546 Apply Bitwise Operations to Make Strings Equal Python O(n) O(1) Explanation 2554 Maximum Number of Integers to Choose From a Range I Python O(n) O(1) Explanation 2571 Minimum Operations to Reduce an Integer to 0 Python O(n) O(1) Explanation 2588 Count the Number of Beautiful Subarrays Python O(n) O(1) Explanation 2683 Neighboring Bitwise XOR Python O(n) O(1) Explanation 2749 Minimum Operations to Make the Integer Zero Python O(n) O(1) Explanation 2762 Continuous Subarrays JavaScript O(n) O(1) Explanation 2871 Split Array Into Maximum Number of Subarrays Python O(n) O(1) Explanation 2914 Minimum Number of Changes to Make Binary String Beautiful Python O(n) O(1) Explanation 2939 Maximum Xor Product Python O(n) O(1) Explanation 2997 Minimum Number of Operations to Make Array XOR Equal to K Python O(n) O(1) Explanation 3007 Maximum Number That Sum of the Prices Is Less Than or Equal to K Python O(n) O(1) Explanation 3011 Find if Array Can Be Sorted Python O(n) O(1) Explanation 3091 Apply Operations to Make Sum of Array Greater Than or Equal to k Python O(n) O(1) Explanation 3097 Shortest Subarray With OR at Least K II Python O(n) O(1) Explanation 3153 Sum of Digit Differences of All Pairs Python O(n) O(1) Explanation 3191 Minimum Operations to Make Binary Array Elements Equal to One I JavaScript O(n) O(1) Explanation 3192 Minimum Operations to Make Binary Array Elements Equal to One II JavaScript O(n) O(1) Explanation 3208 Alternating Groups II Python O(n) O(1) Explanation 3296 Minimum Number of Seconds to Make Mountain Height Zero Python O(n) O(1) Explanation 3315 Construct the Minimum Bitwise Array II Python O(n) O(1) Explanation 3350 Adjacent Increasing Subarrays Detection II Python O(n) O(1) Explanation 3377 Digit Operations to Make Two Integers Equal JavaScript O(n) O(1) Explanation 3599 Partition Array to Minimize XOR Python O(n) O(1) Explanation 3751 Total Waviness of Numbers in Range I Java O(n) O(1) Explanation 3755 Find Maximum Balanced XOR Subarray Length Python O(n) O(1) Explanation 3759 Count Elements With at Least K Greater Values Python O(n) O(1) Explanation 3781 Maximum Score After Binary Swaps JavaScript O(n) O(1) Explanation 3800 Minimum Cost to Make Two Binary Strings Equal JavaScript O(n) O(1) Explanation 3849 Maximum Bitwise XOR After Rearrangement Python O(n) O(1) Explanation 3876 Construct Uniform Parity Array II C++ O(n) O(1) Explanation 3980 Minimum Operations to Transform Binary String JavaScript O(n) O(1) Explanation Hard # Problem Language Time Space Explanation 810 Chalkboard XOR Game Python O(n) O(1) Explanation 878 Nth Magical Number Python O(n) O(1) Explanation 1330 Reverse Subarray To Maximize Array Value Python O(n) O(1) Explanation 1526 Minimum Number of Increments on Subarrays to Form a Target Array Python O(n) O(1) Explanation 1553 Minimum Number of Days to Eat N Oranges Python O(n) O(1) Explanation 1611 Minimum One Bit Operations to Make Integers Zero Python O(n) O(1) Explanation 1835 Find XOR Sum of All Pairs Bitwise AND Python O(n) O(1) Explanation 2117 Abbreviating the Product of a Range Python O(n) O(1) Explanation 2197 Replace Non-Coprime Numbers in Array Python O(n) O(1) Explanation 2338 Count the Number of Ideal Arrays Python O(n) O(1) Explanation 3022 Minimize OR of Remaining Elements Using Operations Python O(n) O(1) Explanation 3171 Find Subarray With Bitwise OR Closest to K Python O(n) O(1) Explanation 3480 Maximize Subarrays After Removing One Conflicting Pair Python O(n) O(1) Explanation 3495 Minimum Operations to Make Array Elements Zero Python O(n) O(1) Explanation 3821 Find Nth Smallest Integer With K One Bits Python O(n) O(1) Explanation 3855 Sum of K-Digit Numbers in a Range Python O(n) O(1) Explanation 3897 Maximum Value of Concatenated Binary Segments JavaScript O(n) O(1) Explanation