- 博客(20)
- 资源 (5)
- 收藏
- 关注
原创 LeetCode 61 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2014-07-08 18:43:15 547
原创 LeetCode 35 Valid Sudoku
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-07-07 13:38:45 957
原创 LeetCode 110 Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe
2014-07-03 22:36:53 544
原创 LeetCode 106 Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.silu
2014-07-03 19:11:50 789
原创 LeetCode 105 Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.思路:digui
2014-07-03 19:10:03 471
原创 LeetCode 147 Insertion Sort List
Sort a linked list using insertion sort.
2014-07-03 16:01:01 483
原创 LeetCode 74 Search a 2D Matrix
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each
2014-07-03 12:35:55 669
原创 LeetCode 75 Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers
2014-07-02 23:20:38 691
原创 LeetCode 56 Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.E
2014-07-02 20:53:38 549
原创 LeetCode 55 Merge Intervals
Given a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].
2014-07-02 20:40:36 404
原创 LeetCode 91 Subsets II
Given a collection of integers that might contain duplicates, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplica
2014-07-02 18:46:22 451
原创 LeetCode 81 Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the
2014-07-02 18:42:37 511
原创 LeetCode 32 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur
2014-07-02 18:40:13 395
原创 LeetCode 78 Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,
2014-07-02 01:12:29 435
原创 java 数组常见的几种排序
1. 数字排序 int[] intArray = new int[] { 4, 1, 3, -23 }; Arrays.sort(intArray); 输出: [-23, 1, 3, 4]2. 字符串排序,先大写后小写 String[] strArray = new String[] { "z", "a", "C" }; Arrays.sort(strArra
2014-07-02 01:05:08 554
原创 LeetCode 31 Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",
2014-07-01 16:41:44 378
原创 LeetCode 119 Pascal's Triangle II
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?
2014-07-01 11:46:20 476
原创 LeetCode 118 Pascal's Triangle
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]]
2014-07-01 11:44:29 385
原创 LeetCode 120 Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [
2014-07-01 09:57:27 464
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人