摘要: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: A partially filled sudoku which 阅读全文
posted @ 2018-03-13 14:22 轻风舞动 阅读(802) 评论(0) 推荐(0) 编辑
摘要: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Example 2: 在一个 阅读全文
posted @ 2018-03-13 12:17 轻风舞动 阅读(520) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n). 求x的n次幂,如果用n个循环相乘,那就太简单了,肯定不是这题要考察的。 解法:利用性质: n是奇数,n % 2 == 1, x^n = x^(n/2) * x^(n/2) * x;n是偶数,n % 2 == 0, x^n = x^(n/2) * x^(n/2 阅读全文
posted @ 2018-03-13 11:50 轻风舞动 阅读(621) 评论(0) 推荐(0) 编辑
摘要: Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000. Example 1:Input: Output 阅读全文
posted @ 2018-03-13 09:41 轻风舞动 阅读(465) 评论(0) 推荐(0) 编辑
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2018-03-13 09:11 轻风舞动 阅读(1160) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest l 阅读全文
posted @ 2018-03-13 07:59 轻风舞动 阅读(470) 评论(0) 推荐(0) 编辑
摘要: The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文
posted @ 2018-03-13 07:24 轻风舞动 阅读(495) 评论(0) 推荐(0) 编辑
摘要: Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文
posted @ 2018-03-13 07:10 轻风舞动 阅读(517) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following unique pe 阅读全文
posted @ 2018-03-13 06:35 轻风舞动 阅读(566) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1 阅读全文
posted @ 2018-03-13 05:44 轻风舞动 阅读(900) 评论(0) 推荐(0) 编辑
摘要: Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 给两个数字n, k,返回所 阅读全文
posted @ 2018-03-13 05:35 轻风舞动 阅读(1522) 评论(0) 推荐(0) 编辑