bit manipulation
yuccess
这个作者很懒,什么都没留下…
展开
-
136. Single Number, leetcode
题目: Given an array of integers, every element appears twice except for one. Find that single one. 解法1,hash map 如代码中注释掉的部分; 解法2,bit manipulation 异或法 class Solution { public: int singleNumbe原创 2016-12-04 21:37:32 · 194 阅读 · 0 评论 -
29. Divide Two Integers 每一行都是精炼
Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 法一:可以直观的利用除数的倍数,但如果这个倍数很大(题目中要求不能用乘法)则会造成LTE, 此法不可行!!! class Solution { public原创 2017-01-06 00:25:14 · 245 阅读 · 0 评论 -
90,78. Subsets II I 典型的回溯算法,另 迭代解法和 位解法
Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = [1,2,3], a solution is: [ [3], [1],原创 2017-01-01 00:08:24 · 472 阅读 · 0 评论