题库chevron_right分类chevron_right位运算
memory

位运算

220 道题目
简单: 45中等: 97困难: 78

位运算 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

题库

位运算 题库

先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。

慢加载专题题库

适合这类题很多的专题,先扫结构,再逐步深入。

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 220 道题目

每次续载 24 题
#题目难度
29

两数相除

Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…

中等
67

二进制求和

Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…

简单
78

子集

Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.

中等
89

格雷编码

Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.

中等
90

子集 II

Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…

中等
136

只出现一次的数字

Solve the Single Number problem using an efficient approach with constant space and linear time complexity.

简单
137

只出现一次的数字 II

Find the single element in an array where every other element appears three times, using bit manipulation and constant s…

中等
187

重复的DNA序列

Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.

中等
190

颠倒二进制位

Reverse a 32-bit unsigned integer by manipulating bits efficiently using a divide and conquer approach with careful bit …

简单
191

位1的个数

Number of 1 Bits is a classic bit manipulation problem where clearing the lowest set bit gives the cleanest count.

简单
201

数字范围按位与

Use shared high bits and bit clearing to solve Bitwise AND of Numbers Range without scanning every value.

中等
222

完全二叉树的节点个数

Count Complete Tree Nodes efficiently by leveraging binary-tree traversal, exploiting completeness, and applying bit man…

简单
231

2 的幂

Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…

简单
260

只出现一次的数字 III

Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.

中等
268

丢失的数字

Find the missing number in an array containing distinct numbers in the range [0, n].

简单
287

寻找重复数

The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…

中等
318

最大单词长度乘积

The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…

中等
338

比特位计数

Compute the number of 1 bits for every integer from 0 to n using state transition dynamic programming for efficiency.

简单
342

4的幂

Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.

简单
371

两整数之和

Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.

中等
389

找不同

Find the Difference involves identifying the additional letter in one string compared to another, emphasizing hash table…

简单
393

UTF-8 编码验证

Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.

中等
397

整数替换

Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…

中等
401

二进制手表

Binary Watch involves generating possible times on a binary watch given a number of turned-on LEDs.

简单

swap_vert在题库框内继续向下滚动,也会自动续载

关联高频模式

LeetCode 位运算题型题解:220题训练路线