面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
两数相除
Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…
二进制求和
Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…
子集
Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.
格雷编码
Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.
子集 II
Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…
只出现一次的数字
Solve the Single Number problem using an efficient approach with constant space and linear time complexity.
只出现一次的数字 II
Find the single element in an array where every other element appears three times, using bit manipulation and constant s…
重复的DNA序列
Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.
颠倒二进制位
Reverse a 32-bit unsigned integer by manipulating bits efficiently using a divide and conquer approach with careful bit …
位1的个数
Number of 1 Bits is a classic bit manipulation problem where clearing the lowest set bit gives the cleanest count.
数字范围按位与
Use shared high bits and bit clearing to solve Bitwise AND of Numbers Range without scanning every value.
完全二叉树的节点个数
Count Complete Tree Nodes efficiently by leveraging binary-tree traversal, exploiting completeness, and applying bit man…
2 的幂
Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…
只出现一次的数字 III
Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.
丢失的数字
Find the missing number in an array containing distinct numbers in the range [0, n].
寻找重复数
The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…
最大单词长度乘积
The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…
比特位计数
Compute the number of 1 bits for every integer from 0 to n using state transition dynamic programming for efficiency.
4的幂
Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.
两整数之和
Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.
找不同
Find the Difference involves identifying the additional letter in one string compared to another, emphasizing hash table…
UTF-8 编码验证
Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.
整数替换
Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…
二进制手表
Binary Watch involves generating possible times on a binary watch given a number of turned-on LEDs.
数字转换为十六进制数
Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.
数组中两个数的最大异或值
Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.
汉明距离
Calculate the Hamming distance between two integers by counting differing bit positions.
我能赢吗
Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…
火柴拼正方形
The problem asks to determine if we can use matchsticks to form a square, exploring dynamic programming and backtracking…
数字的补数
The Number Complement problem requires flipping bits in a number’s binary representation to return its complement.
汉明距离总和
Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.
非递减子序列
Return all possible non-decreasing subsequences with at least two elements from the input array, nums.
优美的排列
The Beautiful Arrangement problem asks for the number of valid permutations of n integers satisfying specific divisibili…
大礼包
Minimize the cost of purchasing items using available special offers with state transition dynamic programming.
错误的集合
Identify the duplicated and missing numbers in an integer array using array scanning combined with hash table lookup eff…
灯泡开关 Ⅱ
Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.
贴纸拼词
Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…
交替位二进制数
Check whether a given integer has alternating bits using a bit manipulation approach.
划分为k个相等的子集
Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…
金字塔转换矩阵
The Pyramid Transition Matrix problem requires determining whether a pyramid can be formed with given blocks and valid p…
二进制表示中质数个计算置位
Count numbers with prime set bits in a binary representation within a given range.
第K个语法符号
Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.
变为棋盘
Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.
字母大小写全排列
Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.
数组的均值分割
Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…
黑板异或游戏
The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…
翻转图像
Flip each row of a binary matrix horizontally and invert its values efficiently using a two-pointer scanning approach.
访问所有节点的最短路径
Solve the Shortest Path Visiting All Nodes problem by exploring dynamic programming, bit manipulation, and breadth-first…
翻转矩阵后的得分
Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.
获取所有钥匙的最短路径
Find the minimum steps to collect all keys in a grid using BFS and bitmasking, handling locks efficiently.
二进制间距
Find the maximum distance between consecutive 1's in a number's binary form using precise bit manipulation techniques.
子数组按位或操作
Compute the number of unique bitwise OR values from all non-empty subarrays using dynamic state transitions efficiently.
最短超级串
This problem requires constructing the shortest string containing all input words using state transition dynamic program…
N 天后的牢房
Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…
不同路径 III
Solve the Unique Paths III problem using backtracking search with pruning to count 4-directional paths covering all empt…
按位与为零的三元组
Count all index triples in an array where the bitwise AND of their elements equals zero using efficient bit manipulation…
K 连续位的最小翻转次数
Determine the minimum number of k-length consecutive bit flips needed to convert all zeros to ones in a binary array eff…
平方数组的数目
Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…
十进制整数的反码
In this problem, you need to return the complement of a given integer by flipping its binary digits.
子串能表示从 1 到 N 数字的二进制串
Check if binary string contains all integers from 1 to n as substrings, leveraging sliding window and bit manipulation t…
可被 5 整除的二进制前缀
Determine which binary prefixes of a given array are divisible by 5 using bit manipulation for efficient checks.
最小的必要团队
Find the smallest subset of people covering all required skills using bitmask dynamic programming for efficient state tr…
构建回文串检测
Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.
猜字谜
Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…
循环码排列
Generate a circular permutation from a range of numbers using backtracking and bit manipulation.
串联字符串的最大长度
Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…
得分最高的单词集合
Calculate the highest total score by selecting words from a list using available letters, respecting individual letter s…
转化为全零矩阵的最少反转次数
Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…
子数组异或查询
Compute XOR results for multiple subarray queries using efficient prefix XOR to reduce repeated computation overhead in …
或运算的最小翻转次数
Determine the minimum number of bit flips required in two integers so that their OR equals a target integer efficiently.
将数字变成 0 的操作次数
Reduce a number to zero using bit manipulation and math. Simulate the process step-by-step based on whether the number i…
参加考试的最大学生数
Calculate the maximum number of students who can take an exam without cheating using state transition dynamic programmin…
根据数字二进制下 1 的数目排序
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 with even counts of vowels using bitmasking and hash tables.
安排电影院座位
Determine the maximum number of four-person groups that can be seated in a cinema using array scanning and hash lookup e…
将二进制表示减到 1 的步骤数
Determine the number of steps to reduce a binary representation of a number to 1 by following specific rules.
每个人戴不同帽子的方案数
Calculate all unique assignments of hats to people using state transition dynamic programming with bitmasking for collis…
形成两个异或相等数组的三元组数目
Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…
二叉树中的伪回文路径
Count all root-to-leaf paths in a binary tree that can be rearranged to form a palindrome using bitwise state tracking.
检查一个字符串是否包含所有长度为 K 的二进制子串
Determine if every possible binary string of length k exists as a substring within a given binary string s efficiently u…
数组异或操作
Compute the bitwise XOR of a dynamically generated array using a combination of math and bit manipulation techniques eff…
并行课程 II
Determine the minimum semesters to complete all courses with prerequisites using state transition dynamic programming an…
找到最接近目标值的函数值
In this problem, you'll use binary search to find the closest value of a mysterious function to a given target.
字符串的好分割数目
Count all valid splits of a string where left and right substrings have equal distinct characters, using efficient state…
找出最长的超赞子字符串
Find the maximum-length awesome substring in a numeric string using hash table and bit manipulation for palindrome poten…
得到目标数组的最少函数调用次数
Calculate the minimum number of modify calls needed to convert an all-zero array into a given target array using greedy …
连通两组点的最小成本
Compute the minimum cost to fully connect two groups of points using dynamic programming and bitmasking efficiently.
最多可达成的换楼请求数目
Find the maximum number of achievable transfer requests between buildings with constraints on net employee transfers.
使整数变为 0 的最少操作次数
Compute the minimum number of one-bit operations to convert a given integer to zero using state transition dynamic progr…
统计子树中城市之间最大距离
This problem asks you to count subtrees in a tree structure where the maximum distance between any two cities matches sp…
分配重复整数
Determine if you can allocate integers to satisfy customer quantities using state transition dynamic programming techniq…
最大化网格幸福感
Maximize Grid Happiness is a dynamic programming problem focusing on state transitions with bitmasking to maximize happi…
连接连续二进制数字
Calculate the decimal value of concatenated binary numbers from 1 to n using efficient bit manipulation techniques.
最小不兼容性
Optimize the sum of incompatibilities when distributing an array into subsets with unique elements.
统计一致字符串的数目
Count the number of strings fully composed of allowed characters using array scanning and hash lookup for efficiency.
与数组中元素的最大异或值
Solve the Maximum XOR With an Element From Array problem by efficiently finding the maximum XOR for each query using bit…
解码异或后的数组
Recover the original integer array from its XOR-encoded version using direct bitwise manipulation and sequential reconst…
完成所有工作的最短时间
Minimize the maximum working time of k workers by optimally assigning jobs, leveraging dynamic programming and bit manip…
解码异或后的排列
Decode XORed Permutation uses prefix reconstruction with global XOR to recover the hidden odd-length permutation in line…
找出第 K 大的异或坐标值
Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…
最接近目标值的子序列和
Find the minimum absolute difference between a target goal and any subsequence sum using optimized dynamic programming a…
最长的美好子字符串
Find the longest nice substring in a given string using the sliding window technique with running state updates.
使所有区间的异或结果为零
Determine the minimum changes needed in an array so all size-k segments XOR to zero using DP and bit manipulation.
N 次操作后的最大分数和
Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …
统计异或值在范围内的数对有多少
Count all pairs in an array whose XOR falls within a given range using efficient bit manipulation techniques and a trie …
得到新鲜甜甜圈的最多组数
Reorder groups to maximize happy customers by using state transition dynamic programming with bitmasking for optimal bat…
每个查询的最大异或值
Find the maximum XOR for each query based on a sorted array and bit manipulation.
所有数对按位与结果的异或和
Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.
找出所有子集的异或总和再求和
Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.
两个数组最小的异或值之和
Minimize the XOR sum of two integer arrays by rearranging elements using dynamic programming and bit manipulation.
最美子字符串的数目
Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.
长度为 3 的不同回文子序列
Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.
查询最大基因差
Find the maximum genetic difference along paths in a tree using array scanning and hash lookups with XOR calculations.
最大兼容性评分和
Assign students to mentors to maximize total compatibility using state transition dynamic programming with bitmask optim…
完成任务的最少工作时间段
Find the minimum number of work sessions needed to finish a set of tasks, considering task durations and session time.
好子集的数目
Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.
两个回文子序列长度的最大乘积
Find two disjoint palindromic subsequences in a string to maximize the product of their lengths efficiently using dynami…
至少在两个数组中出现的值
Identify all elements appearing in at least two of three arrays using efficient scanning and hash lookups for fast verif…
将数组分成两个数组并最小化数组和的差
Partition an integer array into two equal halves to minimize the absolute difference of their sums using dynamic program…
统计按位或能得到最大值的子集数目
Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…
统计追加字母可以获得的单词数
Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …
基于陈述统计最多好人数
Determine the maximum number of good people in a group given mutual statements, using precise backtracking with pruning.
字符串分组
Group words into connected sets using operations on characters with string and bit manipulation techniques.
数组的最大与和
Find the maximum AND sum by placing integers into limited slots using state transition dynamic programming efficiently.
将数组划分成相等数对
Determine if an array of 2n integers can be partitioned into n pairs where each pair contains identical elements using h…
射箭比赛中的最大得分
In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…
转换数字的最少位翻转次数
Determine the minimum number of bit flips required to convert one integer to another using precise bit manipulation.
按位与结果大于零的最长组合
Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…
公平分发饼干
The problem focuses on fairly distributing cookies among children to minimize the maximum unfairness of the distribution…
公司命名
The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…
操作后的最大异或和
Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.
从树中删除边的最小分数
Compute the minimum score after removing two edges in a tree using DFS and XOR-based component tracking efficiently.
第一个出现两次的字母
Find the first letter that repeats in a string using hash table tracking and early detection for efficiency.
优质数对的数目
Calculate the number of excellent pairs in an array using bit counting, hash sets, and efficient pair scanning technique…
被列覆盖的最多行数
Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…
最长优雅子数组
Find the length of the longest nice subarray where the bitwise AND of all pairs of elements in the subarray is zero.
按位或最大的最小子数组长度
Find the smallest subarrays with the maximum bitwise OR for each starting index in an array.
按位与最大的最长子数组
Find the length of the longest subarray whose bitwise AND reaches the array's maximum value, combining array scanning wi…
所有数对的异或和
Compute the overall bitwise XOR from all pairings between two arrays using efficient array and bit manipulation techniqu…
最小异或
Minimize XOR problem asks for an integer that minimizes XOR with another, applying greedy choices for bit manipulation.
找出前缀异或的原始数组
Find the original array from a given prefix XOR array using bitwise manipulation techniques.
二的幂数组中查询范围内的乘积
The Range Product Queries of Powers problem requires calculating the product of powers of 2 for a range of queries on a …
统计相似字符串对的数目
Count similar string pairs by converting each word into a character-set signature and counting matching signatures effic…
查询数组异或美丽值
Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.
执行逐位运算使字符串相等
Determine if a binary string s can be transformed into target using repeated bitwise operations on paired indices effici…
子字符串异或查询
Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…
最小无法得到的或值
Find the smallest positive integer that cannot be formed from any subsequence OR combination in the array.
将整数减少到零需要的最少操作数
Compute the minimum number of operations to reduce a positive integer to zero using additions or subtractions of powers …
无平方子集计数
Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…
统计美丽子数组数目
Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…
奇偶位数
Count the number of 1s at even and odd indices in the binary representation of a given integer n.
找到两个数组的前缀公共数组
This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…
最大或值
Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.
相邻值的按位异或
Determine if a binary array original exists that produces the given derived array using neighboring bitwise XOR logic.
一个小组的最大实力值
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 is a challenging problem involving array scanning, hash lookup, and bit manipulation to…
特别的排列
Count the number of special permutations for a given array using dynamic programming and bit manipulation.
得到整数零需要执行的最少操作数
This problem challenges you to compute the minimum operations to reduce an integer to zero using bit manipulation and st…
树中可以形成回文的路径数
This problem asks you to count all node pairs in a tree whose path characters can be rearranged into a palindrome using …
使子序列的和等于目标的最少操作次数
The problem requires finding the minimum number of operations to form a subsequence summing to a target using powers of …
在传球游戏中最大化函数值
Maximize the total score in a ball-passing game by selecting the best starting player using state transition dynamic pro…
统计距离为 k 的点对
Solve the problem of counting pairs of points with distance k using array scanning and hash table techniques.
计算 K 置位下标对应元素的和
Sum values in an array where the indices have exactly k set bits in binary representation.
收集元素的最少操作次数
Scan from the end, track seen values from 1 to k, and stop once every required number is collected.
将数组分割成最多数目的子数组
Maximize the number of subarrays in an array while ensuring each subarray's bitwise AND meets the minimum score requirem…
对数组执行操作使平方和最大
Maximizing the sum of squares in an array through bitwise operations on selected elements.
找出数组中的 K-or 值
Given an integer array nums and an integer k, find the K-or of nums where bits qualify based on the occurrence of 1s.
收集所有金币可获得的最大积分
Find the maximum points after collecting coins from all nodes of a tree using binary-tree traversal and state tracking.
找出强数对的最大异或值 I
Find the maximum XOR of any strong pair in an integer array using array scanning and hash-based lookups efficiently.
找出强数对的最大异或值 II
Find the maximum XOR among strong pairs in an array using array scanning and hash-based lookups efficiently.
最大异或乘积
Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.
关闭分部的可行集合数目
Calculate all valid sets of branch closures while keeping remaining branches within maxDistance using bitmask and graph …
检查按位或是否存在尾随零
Check if a bitwise OR of two or more numbers has trailing zeros in its binary representation.
使数组异或和等于 K 的最少操作次数
Find the minimum number of operations to make the XOR of an array equal to a given value k by modifying array elements.
执行操作后的最大分割数量
Maximizing the number of partitions in a string after changing one character and applying partitioning operations using …
价值和小于等于 K 的最大数字
Find the greatest number whose accumulated price, based on binary set bit positions, is less than or equal to k.
判断一个数组是否可以变为有序
Determine if a given array can be sorted using adjacent swaps restricted by equal set bits in binary representation.
给定操作次数内使剩余元素的或值最小
Minimize the bitwise OR of the remaining elements of an array after applying at most k operations.
最大节点价值之和
Solve Find the Maximum Sum of Node Values by tracking XOR gain parity, not by simulating edge operations across the tree…
或值至少 K 的最短子数组 I
Find the shortest non-empty subarray in nums whose bitwise OR reaches at least k using sliding window efficiently.
或值至少为 K 的最短子数组 II
Find the length of the shortest subarray where the bitwise OR of all its elements is at least a given value.
带权图里旅途的最小代价
Find the minimum cost walk in a weighted graph using array and bit manipulation techniques for efficient path calculatio…
单面值组合的第 K 小金额
Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…
划分数组得到最小的值之和
Solve the problem of dividing an array into subarrays to match specified bitwise AND values using dynamic programming.
数组最后一个元素的最小值
Construct an array where elements are greater than the previous one, and the bitwise AND of all elements equals a given …
大数组元素的乘积
Solve queries on a massive array of powers of two using binary search to efficiently compute modular products of subarra…
找出分数最低的排列
Determine the lexicographically smallest permutation of nums that minimizes a cyclic score using state transition DP tec…
到达第 K 级台阶的方案数
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
求出出现两次数字的 XOR 值
Find the XOR of numbers appearing twice by scanning the array and using a hash table for efficient tracking and combinat…
找到按位或最接近 K 的子数组
Find a subarray with bitwise OR closest to a given value k with minimal absolute difference.
执行操作可获得的最大总奖励 II
Maximize your total reward using dynamic programming with state transitions in this challenging problem involving array …
使二进制数组全部等于 1 的最少操作次数 I
Find the minimum number of operations to make all elements of a binary array equal to one using sliding window and state…
子数组按位与值为 K 的数目
The problem asks to find the number of subarrays with a given AND value in an array, utilizing binary search for optimiz…
生成不含相邻零的二进制字符串
Generate all binary strings of length n without adjacent zeros using backtracking search with pruning for efficient enum…
使两个整数相等的位更改次数
Find the number of bit changes to make two integers equal using bit manipulation techniques.
选择矩阵中单元格的最大得分
Optimize selection of grid cells using state transition dynamic programming to maximize total sum efficiently.
吃掉所有兵需要的最多移动次数
Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…
求出数组中最大序列值
Determine the maximum value of a subsequence in an integer array using state transition dynamic programming and bit oper…
找出第 K 个字符 I
Find the K-th character in a progressively built string using math and bit manipulation efficiently.
找出第 K 个字符 II
Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…
连接二进制表示可形成的最大数值
Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.
构造最小位运算数组 I
Learn how to construct an array minimizing each element while matching given primes using bitwise operations efficiently…
构造最小位运算数组 II
Learn to build the minimum array matching a bitwise OR pattern for each prime in nums, focusing on binary optimization.
仅含置位位的最小整数
Find the smallest number greater than or equal to n with all set bits in its binary representation.
破解锁的最少时间 I
Solve the Minimum Time to Break Locks I problem using state transition dynamic programming to minimize the time to break…
统计异或值为给定值的路径数目
Count the number of paths in a grid where the XOR of all values along the path equals a given number.
最短公共超序列的字母出现频率
Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …
使数组包含目标值倍数的最少增量
This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…
使数组元素都变为零的最少操作次数
Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…
不同 XOR 三元组的数目 I
Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…
不同 XOR 三元组的数目 II
Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…
有向无环图中合法拓扑排序的最大利润
Solve the Maximum Profit from Valid Topological Order in DAG problem using graph indegree and topological sorting with d…
判断连接可整除性
Find the lexicographically smallest permutation of numbers whose concatenation is divisible by k using state transition …
魔法序列的数组乘积之和
Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…
等积子集的划分方案
Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.
清理教室的最少移动
Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.
最大好子树分数
Find the maximum sum of values in a tree subtree without repeating any digit across selected nodes using DFS and bitmask…
所有人渡河所需的最短时间
Find the minimum time to transport individuals across a river with dynamic environmental conditions and boat capacity.
划分数组得到最小 XOR
Partition an integer array into k subarrays to minimize the maximum XOR using state transition dynamic programming effic…
图中的最长回文路径
Find the longest path in a graph that forms a palindrome using state transition dynamic programming and bitmask techniqu…