Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh…
分类:LeetCode题目解答汇总
LeetCode | Longest Valid Parentheses(最长有效的括号匹配)
Given a string containing just the characters '(' and ')', find the length of the longest valid…
LeetCode | Count and Say(统计并输出)
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1&nbs…
LeetCode | Combination Sum(元素的和)
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher…
LeetCode | Combination Sum II(元素的和---2)
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C&nb…
LeetCode | First Missing Positive(第一个缺失的正整数)
Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] …
LeetCode | Trapping Rain Water(柱子间存储的水容量)
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput…
LeetCode | Jump Game(跳远游戏)
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each el…
LeetCode | Pow(x, n)
实现double Pow(double x,int n)—-x的n次幂! 题目解析: 这道题目看起来很简单,笨方法,可以一次一次的去乘,也可以折半相乘!看似简单,但中间碰到了不小的问题。 在运行过程中,出现了…
LeetCode | Length of Last Word(最后一个单词的长度)
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return …
LeetCode | Spiral Matrix(顺时针打印矩阵)
Given a matrix of m x n elements (m rows, n columns), return all elements o…
LeetCode | Permutations(全排列)
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following p…