--- title: "位运算" created: 2025-11-28 tags: - 算法 --- # 位运算 前导知识: [[00-信息的表示与处理|信息的处理和表示 这一篇就够了]] 要么考察基本知识 要么就是很考验思维 - [[二进制中1的个数|二进制中1的个数]] - [[按要求计算|按要求计算]] - [[2-Learning/02-算法/03-刷题理模型/位运算相关问题/位运算/位运算|位运算]] - [[不用加减乘除做加法|不用加减乘除做加法]] - [[进制|进制]] - [[位操作练习|位操作练习]] - [[中等计算|中等计算]] - [[数组中只出现一次的两个数字|数组中只出现一次的两个数字]] - [[数组中唯一只出现一次的数字|数组中唯一只出现一次的数字]] - [[2-Learning/02-算法/03-刷题理模型/双指针相关模型/对撞指针/反转字符串|反转字符串]] - [[使数组异或等于 K 的最少运算次数|使数组异或等于 K 的最少运算次数]] **更多题目:** **位与** - [2的幂](https://leetcode-cn.com/problems/power-of-two/) - [4的幂](https://leetcode-cn.com/problems/power-of-four/) - [位1的个数](https://leetcode-cn.com/problems/number-of-1-bits/) - [数字范围按位与](https://leetcode-cn.com/problems/bitwise-and-of-numbers-range/) - [数组中数字出现的次数](https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-ii-lcof/) - [按位与为零的三元组](https://leetcode-cn.com/problems/triples-with-bitwise-and-equal-to-zero/) - [所有数对按位与结果的异或和](https://leetcode-cn.com/problems/find-xor-sum-of-all-pairs-bitwise-and/) **位或** - [最大单词长度乘积](https://leetcode-cn.com/problems/maximum-product-of-word-lengths/) - [或运算的最小翻转次数](https://leetcode-cn.com/problems/minimum-flips-to-make-a-or-b-equal-to-c/) - [字符串的好分割数目](https://leetcode-cn.com/problems/number-of-good-ways-to-split-a-string/) - [检查一个字符串是否包含所有长度为K的二进制子串](https://leetcode-cn.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k/) - [统计字符串中的元音子字符串](https://blog.csdn.net/WhereIsHeroFrom/article/details/123963989) - [子数组按位或操作](https://leetcode-cn.com/problems/bitwise-ors-of-subarrays/) **异或** - [交换数字](https://leetcode-cn.com/problems/swap-numbers-lcci/) - [汉明距离](https://leetcode.cn/problems/hamming-distance/solutions/797339/yi-ming-ju-chi-by-leetcode-solution-u1w7/) - [转换数字的最少位翻转次数](https://blog.csdn.net/WhereIsHeroFrom/article/details/123932214) - [只出现一次的数字](https://leetcode-cn.com/problems/single-number/) - [数组异或操作](https://leetcode-cn.com/problems/xor-operation-in-an-array/) - [解码异或后的数组](https://leetcode-cn.com/problems/decode-xored-array/) - [子数组异或查询](https://leetcode-cn.com/problems/xor-queries-of-a-subarray/) - [数组中数字出现的次数](https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/) - [每个查询的最大异或值](https://leetcode-cn.com/problems/maximum-xor-for-each-query/) - [解码异或后的排列](https://leetcode-cn.com/problems/decode-xored-permutation/) - [消失的两个数字](https://leetcode-cn.com/problems/missing-two-lcci/?from=from_parent_mindnote) - [统计追加字母可以获得的单词数](https://blog.csdn.net/WhereIsHeroFrom/article/details/123749752?spm=1001.2014.3001.5501) - [使所有区间的异或结果为零](https://leetcode-cn.com/problems/make-the-xor-of-all-segments-equal-to-zero/) - [设计位集](https://blog.csdn.net/WhereIsHeroFrom/article/details/123650828) **按位取反** - [插入](https://leetcode-cn.com/problems/insert-into-bits-lcci/) - [翻转数位](https://leetcode-cn.com/problems/reverse-bits-lcci/) **位移** - [交替位二进制数](https://leetcode-cn.com/problems/binary-number-with-alternating-bits/) - [第K个语法符号](https://leetcode-cn.com/problems/k-th-symbol-in-grammar/) --- ⬅️ [[a-b|a-b]] 🏠 [[00-刷题理模型]] ➡️ [[不用加减乘除做加法|不用加减乘除做加法]]