Given inorder and postorder traversal of a tree, construct the binary tree.Note: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode ... Read More
posted @ 2015-09-06 16:08 sunalive Views(131) Comments(0) Diggs(0)
1 class Solution { 2 public: 3 vector> threeSum(vector& nums) { 4 if (nums.size() > ans; 9 10 for(int i = 0;i 0 && nums[... Read More
posted @ 2015-09-06 11:22 sunalive Views(140) Comments(0) Diggs(0)
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 fol... Read More
posted @ 2015-09-01 15:05 sunalive Views(188) Comments(0) Diggs(0)
Given an array ofnintegers wheren> 1,nums, return an arrayoutputsuch thatoutput[i]is equal to the product of all the elements ofnumsexceptnums[i].Solv... Read More
posted @ 2015-09-01 11:02 sunalive Views(171) Comments(0) Diggs(0)
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... Read More
posted @ 2015-08-25 17:01 sunalive Views(140) Comments(0) Diggs(0)
Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]retur... Read More
posted @ 2015-08-24 17:33 sunalive Views(132) Comments(0) Diggs(0)
Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i... Read More
posted @ 2015-08-24 11:14 sunalive Views(144) Comments(0) Diggs(0)
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... Read More
posted @ 2015-08-24 10:03 sunalive Views(197) Comments(0) Diggs(0)
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... Read More
posted @ 2015-08-22 22:53 sunalive Views(111) Comments(0) Diggs(0)
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n Read More
posted @ 2015-08-22 21:42 sunalive Views(122) Comments(0) Diggs(0)