摘要:
算法描述: The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the tot 阅读全文
摘要:
算法描述: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserv 阅读全文
摘要:
算法描述: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example 1: Examp 阅读全文
摘要:
算法描述: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1, 阅读全文
摘要:
算法描述: Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate 阅读全文
摘要:
算法描述: Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where 阅读全文
摘要:
算法描述: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. 阅读全文
摘要:
算法描述: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: 解题思路:题目要求给出所有肯能的组合,首先想到了回溯法。需要注意的是下一次迭代的起始是i+ 阅读全文
摘要:
算法描述: Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in 阅读全文
摘要:
算法描述: Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in-place. Example 1: Example 2: Follow up: A straight forwar 阅读全文