bit manipulation
bit manipulation is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.
Interview Signal
Frequently tests problem modeling, edge handling, and verbal clarity.
Common Pitfall
Template-only answers break under follow-up questioning.
Practice Strategy
Practice in 3-5 problem rounds and always review complexity alternatives.
Recommended Progression
Foundation
Pattern Bridge
High-Pressure Round
Divide Two Integers
Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…
Add Binary
Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…
Subsets
Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.
Gray Code
Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.
Subsets II
Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…
Single Number
Solve the Single Number problem using an efficient approach with constant space and linear time complexity.
Single Number II
Find the single element in an array where every other element appears three times, using bit manipulation and constant s…
Repeated DNA Sequences
Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.
Reverse Bits
Reverse a 32-bit unsigned integer by manipulating bits efficiently using a divide and conquer approach with careful bit …
Number of 1 Bits
Number of 1 Bits is a classic bit manipulation problem where clearing the lowest set bit gives the cleanest count.
Bitwise AND of Numbers Range
Use shared high bits and bit clearing to solve Bitwise AND of Numbers Range without scanning every value.
Count Complete Tree Nodes
Count Complete Tree Nodes efficiently by leveraging binary-tree traversal, exploiting completeness, and applying bit man…
Power of Two
Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…
Single Number III
Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.
Missing Number
Find the missing number in an array containing distinct numbers in the range [0, n].
Find the Duplicate Number
The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…
Maximum Product of Word Lengths
The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…
Counting Bits
Compute the number of 1 bits for every integer from 0 to n using state transition dynamic programming for efficiency.
Power of Four
Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.
Sum of Two Integers
Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.
Find the Difference
Find the Difference involves identifying the additional letter in one string compared to another, emphasizing hash table…
UTF-8 Validation
Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.
Integer Replacement
Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…
Binary Watch
Binary Watch involves generating possible times on a binary watch given a number of turned-on LEDs.
Convert a Number to Hexadecimal
Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.
Maximum XOR of Two Numbers in an Array
Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.
Hamming Distance
Calculate the Hamming distance between two integers by counting differing bit positions.
Can I Win
Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…
Matchsticks to Square
The problem asks to determine if we can use matchsticks to form a square, exploring dynamic programming and backtracking…
Number Complement
The Number Complement problem requires flipping bits in a number’s binary representation to return its complement.
Total Hamming Distance
Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.
Non-decreasing Subsequences
Return all possible non-decreasing subsequences with at least two elements from the input array, nums.
Beautiful Arrangement
The Beautiful Arrangement problem asks for the number of valid permutations of n integers satisfying specific divisibili…
Shopping Offers
Minimize the cost of purchasing items using available special offers with state transition dynamic programming.
Set Mismatch
Identify the duplicated and missing numbers in an integer array using array scanning combined with hash table lookup eff…
Bulb Switcher II
Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.
Stickers to Spell Word
Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…
Binary Number with Alternating Bits
Check whether a given integer has alternating bits using a bit manipulation approach.
Partition to K Equal Sum Subsets
Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…
Pyramid Transition Matrix
The Pyramid Transition Matrix problem requires determining whether a pyramid can be formed with given blocks and valid p…
Prime Number of Set Bits in Binary Representation
Count numbers with prime set bits in a binary representation within a given range.
K-th Symbol in Grammar
Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.
Transform to Chessboard
Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.
Letter Case Permutation
Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.
Split Array With Same Average
Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…
Chalkboard XOR Game
The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…
Flipping an Image
Flip each row of a binary matrix horizontally and invert its values efficiently using a two-pointer scanning approach.
Shortest Path Visiting All Nodes
Solve the Shortest Path Visiting All Nodes problem by exploring dynamic programming, bit manipulation, and breadth-first…
Score After Flipping Matrix
Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.
Shortest Path to Get All Keys
Find the minimum steps to collect all keys in a grid using BFS and bitmasking, handling locks efficiently.
Binary Gap
Find the maximum distance between consecutive 1's in a number's binary form using precise bit manipulation techniques.
Bitwise ORs of Subarrays
Compute the number of unique bitwise OR values from all non-empty subarrays using dynamic state transitions efficiently.
Find the Shortest Superstring
This problem requires constructing the shortest string containing all input words using state transition dynamic program…
Prison Cells After N Days
Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…
Unique Paths III
Solve the Unique Paths III problem using backtracking search with pruning to count 4-directional paths covering all empt…
Triples with Bitwise AND Equal To Zero
Count all index triples in an array where the bitwise AND of their elements equals zero using efficient bit manipulation…
Minimum Number of K Consecutive Bit Flips
Determine the minimum number of k-length consecutive bit flips needed to convert all zeros to ones in a binary array eff…
Number of Squareful Arrays
Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…
Complement of Base 10 Integer
In this problem, you need to return the complement of a given integer by flipping its binary digits.
Binary String With Substrings Representing 1 To N
Check if binary string contains all integers from 1 to n as substrings, leveraging sliding window and bit manipulation t…
Binary Prefix Divisible By 5
Determine which binary prefixes of a given array are divisible by 5 using bit manipulation for efficient checks.
Smallest Sufficient Team
Find the smallest subset of people covering all required skills using bitmask dynamic programming for efficient state tr…
Can Make Palindrome from Substring
Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.
Number of Valid Words for Each Puzzle
Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…
Circular Permutation in Binary Representation
Generate a circular permutation from a range of numbers using backtracking and bit manipulation.
Maximum Length of a Concatenated String with Unique Characters
Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…
Maximum Score Words Formed by Letters
Calculate the highest total score by selecting words from a list using available letters, respecting individual letter s…
Minimum Number of Flips to Convert Binary Matrix to Zero Matrix
Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…
XOR Queries of a Subarray
Compute XOR results for multiple subarray queries using efficient prefix XOR to reduce repeated computation overhead in …
Minimum Flips to Make a OR b Equal to c
Determine the minimum number of bit flips required in two integers so that their OR equals a target integer efficiently.
Number of Steps to Reduce a Number to Zero
Reduce a number to zero using bit manipulation and math. Simulate the process step-by-step based on whether the number i…
Maximum Students Taking Exam
Calculate the maximum number of students who can take an exam without cheating using state transition dynamic programmin…
Sort Integers by The Number of 1 Bits
Sort an array of integers by the number of 1's in their binary representation and then by their value in case of ties.
Find the Longest Substring Containing Vowels in Even Counts
Find the longest substring with even counts of vowels using bitmasking and hash tables.
Cinema Seat Allocation
Determine the maximum number of four-person groups that can be seated in a cinema using array scanning and hash lookup e…
Number of Steps to Reduce a Number in Binary Representation to One
Determine the number of steps to reduce a binary representation of a number to 1 by following specific rules.
Number of Ways to Wear Different Hats to Each Other
Calculate all unique assignments of hats to people using state transition dynamic programming with bitmasking for collis…
Count Triplets That Can Form Two Arrays of Equal XOR
Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…
Pseudo-Palindromic Paths in a Binary Tree
Count all root-to-leaf paths in a binary tree that can be rearranged to form a palindrome using bitwise state tracking.
Check If a String Contains All Binary Codes of Size K
Determine if every possible binary string of length k exists as a substring within a given binary string s efficiently u…
XOR Operation in an Array
Compute the bitwise XOR of a dynamically generated array using a combination of math and bit manipulation techniques eff…
Parallel Courses II
Determine the minimum semesters to complete all courses with prerequisites using state transition dynamic programming an…
Find a Value of a Mysterious Function Closest to Target
In this problem, you'll use binary search to find the closest value of a mysterious function to a given target.
Number of Good Ways to Split a String
Count all valid splits of a string where left and right substrings have equal distinct characters, using efficient state…
Find Longest Awesome Substring
Find the maximum-length awesome substring in a numeric string using hash table and bit manipulation for palindrome poten…
Minimum Numbers of Function Calls to Make Target Array
Calculate the minimum number of modify calls needed to convert an all-zero array into a given target array using greedy …
Minimum Cost to Connect Two Groups of Points
Compute the minimum cost to fully connect two groups of points using dynamic programming and bitmasking efficiently.
Maximum Number of Achievable Transfer Requests
Find the maximum number of achievable transfer requests between buildings with constraints on net employee transfers.
Minimum One Bit Operations to Make Integers Zero
Compute the minimum number of one-bit operations to convert a given integer to zero using state transition dynamic progr…
Count Subtrees With Max Distance Between Cities
This problem asks you to count subtrees in a tree structure where the maximum distance between any two cities matches sp…
Distribute Repeating Integers
Determine if you can allocate integers to satisfy customer quantities using state transition dynamic programming techniq…
Maximize Grid Happiness
Maximize Grid Happiness is a dynamic programming problem focusing on state transitions with bitmasking to maximize happi…
Concatenation of Consecutive Binary Numbers
Calculate the decimal value of concatenated binary numbers from 1 to n using efficient bit manipulation techniques.
Minimum Incompatibility
Optimize the sum of incompatibilities when distributing an array into subsets with unique elements.
Count the Number of Consistent Strings
Count the number of strings fully composed of allowed characters using array scanning and hash lookup for efficiency.
Maximum XOR With an Element From Array
Solve the Maximum XOR With an Element From Array problem by efficiently finding the maximum XOR for each query using bit…
Decode XORed Array
Recover the original integer array from its XOR-encoded version using direct bitwise manipulation and sequential reconst…
Find Minimum Time to Finish All Jobs
Minimize the maximum working time of k workers by optimally assigning jobs, leveraging dynamic programming and bit manip…
Decode XORed Permutation
Decode XORed Permutation uses prefix reconstruction with global XOR to recover the hidden odd-length permutation in line…
Find Kth Largest XOR Coordinate Value
Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…
Closest Subsequence Sum
Find the minimum absolute difference between a target goal and any subsequence sum using optimized dynamic programming a…
Longest Nice Substring
Find the longest nice substring in a given string using the sliding window technique with running state updates.
Make the XOR of All Segments Equal to Zero
Determine the minimum changes needed in an array so all size-k segments XOR to zero using DP and bit manipulation.
Maximize Score After N Operations
Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …
Count Pairs With XOR in a Range
Count all pairs in an array whose XOR falls within a given range using efficient bit manipulation techniques and a trie …
Maximum Number of Groups Getting Fresh Donuts
Reorder groups to maximize happy customers by using state transition dynamic programming with bitmasking for optimal bat…
Maximum XOR for Each Query
Find the maximum XOR for each query based on a sorted array and bit manipulation.
Find XOR Sum of All Pairs Bitwise AND
Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.
Sum of All Subset XOR Totals
Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.
Minimum XOR Sum of Two Arrays
Minimize the XOR sum of two integer arrays by rearranging elements using dynamic programming and bit manipulation.
Number of Wonderful Substrings
Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.
Unique Length-3 Palindromic Subsequences
Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.
Maximum Genetic Difference Query
Find the maximum genetic difference along paths in a tree using array scanning and hash lookups with XOR calculations.
Maximum Compatibility Score Sum
Assign students to mentors to maximize total compatibility using state transition dynamic programming with bitmask optim…
Minimum Number of Work Sessions to Finish the Tasks
Find the minimum number of work sessions needed to finish a set of tasks, considering task durations and session time.
The Number of Good Subsets
Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.
Maximum Product of the Length of Two Palindromic Subsequences
Find two disjoint palindromic subsequences in a string to maximize the product of their lengths efficiently using dynami…
Two Out of Three
Identify all elements appearing in at least two of three arrays using efficient scanning and hash lookups for fast verif…
Partition Array Into Two Arrays to Minimize Sum Difference
Partition an integer array into two equal halves to minimize the absolute difference of their sums using dynamic program…
Count Number of Maximum Bitwise-OR Subsets
Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…
Count Words Obtained After Adding a Letter
Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …
Maximum Good People Based on Statements
Determine the maximum number of good people in a group given mutual statements, using precise backtracking with pruning.
Groups of Strings
Group words into connected sets using operations on characters with string and bit manipulation techniques.
Maximum AND Sum of Array
Find the maximum AND sum by placing integers into limited slots using state transition dynamic programming efficiently.
Divide Array Into Equal Pairs
Determine if an array of 2n integers can be partitioned into n pairs where each pair contains identical elements using h…
Maximum Points in an Archery Competition
In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…
Minimum Bit Flips to Convert Number
Determine the minimum number of bit flips required to convert one integer to another using precise bit manipulation.
Largest Combination With Bitwise AND Greater Than Zero
Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…
Fair Distribution of Cookies
The problem focuses on fairly distributing cookies among children to minimize the maximum unfairness of the distribution…
Naming a Company
The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…
Maximum XOR After Operations
Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.
Minimum Score After Removals on a Tree
Compute the minimum score after removing two edges in a tree using DFS and XOR-based component tracking efficiently.
First Letter to Appear Twice
Find the first letter that repeats in a string using hash table tracking and early detection for efficiency.
Number of Excellent Pairs
Calculate the number of excellent pairs in an array using bit counting, hash sets, and efficient pair scanning technique…
Maximum Rows Covered by Columns
Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…
Longest Nice Subarray
Find the length of the longest nice subarray where the bitwise AND of all pairs of elements in the subarray is zero.
Smallest Subarrays With Maximum Bitwise OR
Find the smallest subarrays with the maximum bitwise OR for each starting index in an array.
Longest Subarray With Maximum Bitwise AND
Find the length of the longest subarray whose bitwise AND reaches the array's maximum value, combining array scanning wi…
Bitwise XOR of All Pairings
Compute the overall bitwise XOR from all pairings between two arrays using efficient array and bit manipulation techniqu…
Minimize XOR
Minimize XOR problem asks for an integer that minimizes XOR with another, applying greedy choices for bit manipulation.
Find The Original Array of Prefix Xor
Find the original array from a given prefix XOR array using bitwise manipulation techniques.
Range Product Queries of Powers
The Range Product Queries of Powers problem requires calculating the product of powers of 2 for a range of queries on a …
Count Pairs Of Similar Strings
Count similar string pairs by converting each word into a character-set signature and counting matching signatures effic…
Find Xor-Beauty of Array
Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.
Apply Bitwise Operations to Make Strings Equal
Determine if a binary string s can be transformed into target using repeated bitwise operations on paired indices effici…
Substring XOR Queries
Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…
Minimum Impossible OR
Find the smallest positive integer that cannot be formed from any subsequence OR combination in the array.
Minimum Operations to Reduce an Integer to 0
Compute the minimum number of operations to reduce a positive integer to zero using additions or subtractions of powers …
Count the Number of Square-Free Subsets
Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…
Count the Number of Beautiful Subarrays
Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…
Number of Even and Odd Bits
Count the number of 1s at even and odd indices in the binary representation of a given integer n.
Find the Prefix Common Array of Two Arrays
This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…
Maximum OR
Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.
Neighboring Bitwise XOR
Determine if a binary array original exists that produces the given derived array using neighboring bitwise XOR logic.
Maximum Strength of a Group
Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…
Find a Good Subset of the Matrix
Find a Good Subset of the Matrix is a challenging problem involving array scanning, hash lookup, and bit manipulation to…
Special Permutations
Count the number of special permutations for a given array using dynamic programming and bit manipulation.
Minimum Operations to Make the Integer Zero
This problem challenges you to compute the minimum operations to reduce an integer to zero using bit manipulation and st…
Count Paths That Can Form a Palindrome in a Tree
This problem asks you to count all node pairs in a tree whose path characters can be rearranged into a palindrome using …
Minimum Operations to Form Subsequence With Target Sum
The problem requires finding the minimum number of operations to form a subsequence summing to a target using powers of …
Maximize Value of Function in a Ball Passing Game
Maximize the total score in a ball-passing game by selecting the best starting player using state transition dynamic pro…
Count Pairs of Points With Distance k
Solve the problem of counting pairs of points with distance k using array scanning and hash table techniques.
Sum of Values at Indices With K Set Bits
Sum values in an array where the indices have exactly k set bits in binary representation.
Minimum Operations to Collect Elements
Scan from the end, track seen values from 1 to k, and stop once every required number is collected.
Split Array Into Maximum Number of Subarrays
Maximize the number of subarrays in an array while ensuring each subarray's bitwise AND meets the minimum score requirem…
Apply Operations on Array to Maximize Sum of Squares
Maximizing the sum of squares in an array through bitwise operations on selected elements.
Find the K-or of an Array
Given an integer array nums and an integer k, find the K-or of nums where bits qualify based on the occurrence of 1s.
Maximum Points After Collecting Coins From All Nodes
Find the maximum points after collecting coins from all nodes of a tree using binary-tree traversal and state tracking.
Maximum Strong Pair XOR I
Find the maximum XOR of any strong pair in an integer array using array scanning and hash-based lookups efficiently.
Maximum Strong Pair XOR II
Find the maximum XOR among strong pairs in an array using array scanning and hash-based lookups efficiently.
Maximum Xor Product
Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.
Number of Possible Sets of Closing Branches
Calculate all valid sets of branch closures while keeping remaining branches within maxDistance using bitmask and graph …
Check if Bitwise OR Has Trailing Zeros
Check if a bitwise OR of two or more numbers has trailing zeros in its binary representation.
Minimum Number of Operations to Make Array XOR Equal to K
Find the minimum number of operations to make the XOR of an array equal to a given value k by modifying array elements.
Maximize the Number of Partitions After Operations
Maximizing the number of partitions in a string after changing one character and applying partitioning operations using …
Maximum Number That Sum of the Prices Is Less Than or Equal to K
Find the greatest number whose accumulated price, based on binary set bit positions, is less than or equal to k.
Find if Array Can Be Sorted
Determine if a given array can be sorted using adjacent swaps restricted by equal set bits in binary representation.
Minimize OR of Remaining Elements Using Operations
Minimize the bitwise OR of the remaining elements of an array after applying at most k operations.
Find the Maximum Sum of Node Values
Solve Find the Maximum Sum of Node Values by tracking XOR gain parity, not by simulating edge operations across the tree…
Shortest Subarray With OR at Least K I
Find the shortest non-empty subarray in nums whose bitwise OR reaches at least k using sliding window efficiently.
Shortest Subarray With OR at Least K II
Find the length of the shortest subarray where the bitwise OR of all its elements is at least a given value.
Minimum Cost Walk in Weighted Graph
Find the minimum cost walk in a weighted graph using array and bit manipulation techniques for efficient path calculatio…
Kth Smallest Amount With Single Denomination Combination
Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…
Minimum Sum of Values by Dividing Array
Solve the problem of dividing an array into subarrays to match specified bitwise AND values using dynamic programming.
Minimum Array End
Construct an array where elements are greater than the previous one, and the bitwise AND of all elements equals a given …
Find Products of Elements of Big Array
Solve queries on a massive array of powers of two using binary search to efficiently compute modular products of subarra…
Find the Minimum Cost Array Permutation
Determine the lexicographically smallest permutation of nums that minimizes a cyclic score using state transition DP tec…
Find Number of Ways to Reach the K-th Stair
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
Find the XOR of Numbers Which Appear Twice
Find the XOR of numbers appearing twice by scanning the array and using a hash table for efficient tracking and combinat…
Find Subarray With Bitwise OR Closest to K
Find a subarray with bitwise OR closest to a given value k with minimal absolute difference.
Maximum Total Reward Using Operations II
Maximize your total reward using dynamic programming with state transitions in this challenging problem involving array …
Minimum Operations to Make Binary Array Elements Equal to One I
Find the minimum number of operations to make all elements of a binary array equal to one using sliding window and state…
Number of Subarrays With AND Value of K
The problem asks to find the number of subarrays with a given AND value in an array, utilizing binary search for optimiz…
Generate Binary Strings Without Adjacent Zeros
Generate all binary strings of length n without adjacent zeros using backtracking search with pruning for efficient enum…
Number of Bit Changes to Make Two Integers Equal
Find the number of bit changes to make two integers equal using bit manipulation techniques.
Select Cells in Grid With Maximum Score
Optimize selection of grid cells using state transition dynamic programming to maximize total sum efficiently.
Maximum Number of Moves to Kill All Pawns
Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…
Find the Maximum Sequence Value of Array
Determine the maximum value of a subsequence in an integer array using state transition dynamic programming and bit oper…
Find the K-th Character in String Game I
Find the K-th character in a progressively built string using math and bit manipulation efficiently.
Find the K-th Character in String Game II
Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…
Maximum Possible Number by Binary Concatenation
Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.
Construct the Minimum Bitwise Array I
Learn how to construct an array minimizing each element while matching given primes using bitwise operations efficiently…
Construct the Minimum Bitwise Array II
Learn to build the minimum array matching a bitwise OR pattern for each prime in nums, focusing on binary optimization.
Smallest Number With All Set Bits
Find the smallest number greater than or equal to n with all set bits in its binary representation.
Minimum Time to Break Locks I
Solve the Minimum Time to Break Locks I problem using state transition dynamic programming to minimize the time to break…
Count Paths With the Given XOR Value
Count the number of paths in a grid where the XOR of all values along the path equals a given number.
Frequencies of Shortest Supersequences
Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …
Minimum Increments for Target Multiples in an Array
This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…
Minimum Operations to Make Array Elements Zero
Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…
Number of Unique XOR Triplets I
Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…
Number of Unique XOR Triplets II
Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…
Maximum Profit from Valid Topological Order in DAG
Solve the Maximum Profit from Valid Topological Order in DAG problem using graph indegree and topological sorting with d…
Concatenated Divisibility
Find the lexicographically smallest permutation of numbers whose concatenation is divisible by k using state transition …
Find Sum of Array Product of Magical Sequences
Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…
Partition Array into Two Equal Product Subsets
Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.
Minimum Moves to Clean the Classroom
Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.
Maximum Good Subtree Score
Find the maximum sum of values in a tree subtree without repeating any digit across selected nodes using DFS and bitmask…
Minimum Time to Transport All Individuals
Find the minimum time to transport individuals across a river with dynamic environmental conditions and boat capacity.
Partition Array to Minimize XOR
Partition an integer array into k subarrays to minimize the maximum XOR using state transition dynamic programming effic…
Longest Palindromic Path in Graph
Find the longest path in a graph that forms a palindrome using state transition dynamic programming and bitmask techniqu…
Related Patterns
State transition dynamic programming
54 linked problems
Array scanning plus hash lookup
34 linked problems
Array plus Bit Manipulation
24 linked problems
Backtracking search with pruning
15 linked problems
Math plus Bit Manipulation
13 linked problems
Bit Manipulation-driven solution strategy
11 linked problems