【leetcode】39. Combination Sum 求整数数组里的等于指定值的所有子集

2016-10-27
阅读 2 分钟
2.8k
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.

【leetcode】38. Count and Say 数字转换

2016-10-27
阅读 1 分钟
3.7k
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...

【leetcode】37. Sudoku Solver 解数独

2016-10-27
阅读 11 分钟
1.9k
1. 题目 Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution. A sudoku puzzle... ...and its solution numbers marked in red. [链接] 2. 思路 每次找到最合适填入点进行试探。每次...

【leetcode】36. Valid Sudoku 给定的数独表格是否是满足规则的

2016-10-26
阅读 2 分钟
2.6k
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.

【leetcode】35. Search Insert Position 给定数字插入有序数组的下标点

2016-10-26
阅读 1 分钟
2.2k
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

【leetcode】34. Search for a Range 给定数组的给定值的下标范围

2016-10-26
阅读 2 分钟
2.4k
Given a sorted array of integers, find the starting and ending position of a given target value.

【leetcode】33. Search in Rotated Sorted Array 循环有序数组的二分查找

2016-10-26
阅读 2 分钟
3.9k
Suppose a sorted array is rotated at some pivot unknown to you beforehand.

【leetcode】32. Longest Valid Parentheses 最长的有效匹配括号子串长度

2016-10-26
阅读 2 分钟
3.6k
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.

【leetcode】31. Next Permutation 数字序列的所有组合中比给定串大的下一个最小的串

2016-10-26
阅读 2 分钟
3.4k
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.

【leetcode】30. Substring with Concatenation of All Words 精确匹配的子串集

2016-10-25
阅读 4 分钟
1.6k
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.

【leetcode】29. Divide Two Integers 不能使用乘除法的整数除法

2016-10-25
阅读 2 分钟
2.7k
Divide two integers without using multiplication, division and mod operator.

【leetcode】28. Implement strStr() 字符串匹配KMP BM

2016-10-25
阅读 5 分钟
2.7k
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

【leetcode】27. Remove Element 删除数组指定值的元素

2016-10-25
阅读 1 分钟
2k
Given an array and a value, remove all instances of that value in place and return the new length.

【leetcode】26. Remove Duplicates from Sorted Array 删除有序数组的重复元素

2016-10-25
阅读 1 分钟
2.3k
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

【leetcode】25. Reverse Nodes in k-Group 链表按K分段逆序

2016-10-25
阅读 2 分钟
2.8k
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.

【leetcode】24. Swap Nodes in Pairs 链表奇偶节点交换

2016-10-25
阅读 2 分钟
2.9k
Given a linked list, swap every two adjacent nodes and return its head.

【leetcode】23. Merge k Sorted Lists 多个有序链表的合并有序

2016-10-25
阅读 4 分钟
2.3k
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

【leetcode】22. Generate Parentheses 合法括号串的所有组合

2016-10-25
阅读 2 分钟
2.6k
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

【leetcode】21. Merge Two Sorted Lists 两个有序链表的归并有序

2016-10-25
阅读 2 分钟
2k
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

【leetcode】20. Valid Parentheses 括号串的合法判断

2016-10-25
阅读 2 分钟
2k
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

【leetcode】19. Remove Nth Node From End of List 删除链表的倒数第N个元素

2016-10-25
阅读 1 分钟
1.7k
Given a linked list, remove the nth node from the end of list and return its head.

【Leetcode】18. 4Sum 给定数组中的4个元素之和等于给定值的所有组合

2016-10-25
阅读 3 分钟
2.2k
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.

【Leetcode】17. Letter Combinations of a Phone Number 九键的数字串转字母串

2016-10-25
阅读 2 分钟
2.4k
Given a digit string, return all possible letter combinations that the number could represent.

【Leetcode】16. 3Sum Closest 集合中选三个元素之和最接近指定值

2016-10-25
阅读 2 分钟
1.6k
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.

【Leetcode】15. 3Sum 集合中选三个元素之和等于0

2016-10-25
阅读 2 分钟
2.7k
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.

【Leetcode】14. Longest Common Prefix 两个字符串的最长公共前缀长度

2016-10-25
阅读 1 分钟
3.3k
Write a function to find the longest common prefix string amongst an array of strings.

【Leetcode】13. Roman to Integer 罗马数字转阿拉伯数字

2016-10-25
阅读 1 分钟
2.1k
1. 题目 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 2. 思路 按序累加即可。考虑{4、9}*10^i的场景,做好减法和多跳一步。 3. 代码 耗时:29ms {代码...}

【Leetcode】12. Integer to Roman 阿拉伯数字转罗马数字

2016-10-25
阅读 2 分钟
3.8k
1. 题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 2. 思路 罗马数字的规则: 字符:M=1000, D=500, C=100, L=50, X=10, V=5, I=1. 按序累加即可。 {1,5} * 10^i, 在千这个范围的规则字符数 考虑字符的下一位的最小值,比如{4,9}*10^i, 是通...

【Leetcode】11. Container With Most Water 数列中选两个值使得中间的面积最大

2016-10-25
阅读 1 分钟
1.5k
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most wa...

【leetcode】10. Regular Expression Matching 简易正则匹配

2016-10-25
阅读 2 分钟
3.3k
'.' Matches any single character.'*' Matches zero or more of the preceding element.