- 博客(16)
- 收藏
- 关注
转载 [LeetCode] 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...
2015-08-14 05:11:00 93
转载 <转>
题目Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division an...
2015-08-09 01:38:00 95
转载 [LeetCode]Generate Parentheses
Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()(...
2015-08-09 01:01:00 73
转载 Coins in a Line II
There are n coins with different value in a line. Two players take turns to take one or two coins from left side until there are no more coins left. The player who take the coins with the most va...
2015-08-07 07:45:00 84
转载 Permutations of Array
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],[3,1,2], and[3,2,1].Thoughts:You ...
2015-08-05 04:20:00 105
转载 Longest Common Subsequence Problem
Thelongest common subsequence(LCS)problemis the problem of finding the longestsubsequencecommon to all sequences in a set of sequences (often just two sequences). It differs from problems o...
2015-07-30 05:08:00 188
转载 Submatrix Sum
Given an integer matrix, find a submatrix where the sum of numbers is zero. Your code should return the coordinate of the left-up and right-down number.ExampleGiven matrix[ [1 ,5 ,7],...
2015-07-28 02:37:00 196
转载 Reverse Linked List
Reverse a singly linked list.Thoughts:1.Iterative Method.Loop the linked list, set two pointers, one called"first" to always point to the head of the list, the other called "tail" to ma...
2015-07-18 02:27:00 80
转载 Implementing Stack Using Queue
Question:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element....
2015-07-17 05:23:00 99
转载 Majority Element
Question:Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the array is non-empty and the major...
2015-07-14 05:41:00 88
转载 Minimum Depth of Binary Tree
http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/This question is pretty similar to the solution of Maximum Depth of Binary Tree, the only difference is that apart from the if c...
2015-06-30 05:22:00 78
转载 Maximum Depth of Binary Tree
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 leaf node.Thoughts:recursive DFS is mo...
2015-06-27 04:16:00 91
转载 Climbing Stairs
You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?This problem is actually...
2015-06-26 03:11:00 78
转载 Sudoku Solver
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 p...
2015-06-12 21:23:00 93
转载 Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this in place w...
2015-06-01 20:41:00 60
转载 Merge Two Sorted List
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./** * Definition for singly-linked list. * public...
2015-05-29 23:43:00 68
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人