2014年12月29日

[leetcode] 4Sum

摘要: 4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum... 阅读全文

posted @ 2014-12-29 19:31 cha1992 阅读(145) 评论(0) 推荐(0) 编辑

[leetcode] 3Sum

摘要: 3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El... 阅读全文

posted @ 2014-12-29 12:42 cha1992 阅读(167) 评论(0) 推荐(0) 编辑

2014年12月28日

[leetcode] Two Sum

摘要: Two SumGiven 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... 阅读全文

posted @ 2014-12-28 11:23 cha1992 阅读(160) 评论(0) 推荐(0) 编辑

[leetcode] 3Sum Closest

摘要: 3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three int... 阅读全文

posted @ 2014-12-28 11:03 cha1992 阅读(200) 评论(0) 推荐(0) 编辑

2014年12月27日

[leetcode] Combination Sum

摘要: Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thes... 阅读全文

posted @ 2014-12-27 13:11 cha1992 阅读(143) 评论(0) 推荐(0) 编辑

2014年12月26日

[leetcode] Majority Element

摘要: Majority ElementGiven an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may ass... 阅读全文

posted @ 2014-12-26 10:56 cha1992 阅读(106) 评论(0) 推荐(0) 编辑

2014年12月25日

[leetcode] Jump Game

摘要: Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo... 阅读全文

posted @ 2014-12-25 13:42 cha1992 阅读(130) 评论(0) 推荐(0) 编辑

2014年12月24日

[leetcode] Convert Sorted List to Binary Search Tree

摘要: Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.... 阅读全文

posted @ 2014-12-24 13:37 cha1992 阅读(101) 评论(0) 推荐(0) 编辑

2014年12月23日

[leetcode] Search for a Range

摘要: Search for a RangeGiven a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity ... 阅读全文

posted @ 2014-12-23 12:55 cha1992 阅读(125) 评论(0) 推荐(0) 编辑

2014年12月22日

[leetcode] Flatten Binary Tree to Linked List

摘要: Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ... 阅读全文

posted @ 2014-12-22 23:01 cha1992 阅读(99) 评论(0) 推荐(0) 编辑

导航