- 博客(16)
- 收藏
- 关注
原创 刷题-Valid Sudoku 缺python
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A partially fille
2014-12-05 16:12:28
264
原创 刷题-Min Stack 缺python
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get
2014-12-05 16:11:31
341
原创 刷题-Symmetric Tree 缺python
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f
2014-12-05 16:10:45
300
原创 刷题-Same Tree 缺python
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.java:/
2014-12-05 16:10:03
347
原创 刷题-Valid Parentheses 缺python
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2014-12-05 16:09:18
292
原创 刷题-Path Sum 缺python
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum
2014-12-05 16:07:59
279
原创 刷题-Minimum Depth of Binary Tree 缺python
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.java:/** * Definition for bi
2014-12-05 16:06:58
379
原创 刷题-Pascal's Triangle II 缺python
Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?java:publi
2014-12-05 16:05:46
236
原创 刷题-Pascal's Triangle 缺python
Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]java:public class Soluti
2014-12-05 16:05:06
315
原创 刷题-Valid Palindrome 缺python
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a
2014-12-05 16:03:40
216
原创 刷题-Roman to Integer 缺python
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public int romanToInt(String s) { if (s.length
2014-12-05 16:02:39
270
原创 刷题-String to Integer (atoi)缺python
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca
2014-12-05 16:01:30
388
原创 刷题-ZigZag Conversion 缺python
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I
2014-12-05 14:34:32
278
原创 刷题—Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.java:通过int转换为string,看string是否首位与相应的位相等,判断是不是palindromepublic class Solution { public boolean isPalindrome(int x) {
2014-12-05 11:42:26
212
原创 刷题-Count and Say-缺python
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as
2014-12-04 18:00:56
212
原创 刷题-Maximum Depth of Binary Tree
java解法:public class Solution { public int maxDepth(TreeNode root) { if (root==null) return 0; int left = maxDepth(root.left); int right = maxDepth(root.right);
2014-12-04 17:07:41
485
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人