
leetcode
Matttteo
昨夜西风凋碧树,独上西楼,望尽天涯路
展开
-
[leetcode]single number
题目: Given an array of integers, every element appears twice except for one. Find that single one. 这题的标签是hash table和bit manipulation,首先想到bit manipulation的思路,由于一个整型数和自己的异或操作得到是全零,全零和任何整型异或都不会改变整型的原创 2015-04-18 15:41:04 · 360 阅读 · 0 评论 -
[leetcode]Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] has the原创 2015-04-22 19:51:58 · 408 阅读 · 0 评论 -
[leetcode]Largest Number
题目如下:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be very l原创 2015-04-11 23:28:23 · 435 阅读 · 0 评论 -
[leetcode]Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1原创 2015-04-13 15:21:43 · 296 阅读 · 0 评论 -
[leetcode]Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1,3,2,1,2,1],原创 2015-04-24 23:19:09 · 336 阅读 · 0 评论