摘要:
Given a list of numbers that may has duplicate numbers, return all possible subsets class Solution { /** * @param S: A set of numbers. * @return: A li 阅读全文
摘要:
Given a set of distinct integers, return all possible subsets. 这是一道排列与组合的问题, 对于这种题目就是求所有的方案,其中90%是用搜索, 而搜素的题目90%会用到递归。 这类题目的模版 1)把现在结果加进去 2)用for loop做 阅读全文
摘要:
Given two sorted integer arrays A and B, merge B into A as one sorted array. Notice You may assume that A has enough space (size that is greater or eq 阅读全文
摘要:
Using O(1) time to check whether an integer n is a power of 2. Example For n=4, return true; For n=5, return false; 思路: 知识点: n & (n - 1) 使得从右边数最后一个1变为 阅读全文
摘要:
Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your al 阅读全文