摘要: 题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The lon... 阅读全文
posted @ 2014-07-26 13:07 爱做饭的小莹子 阅读(2485) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surroun... 阅读全文
posted @ 2014-07-26 11:59 爱做饭的小莹子 阅读(3593) 评论(0) 推荐(0) 编辑
摘要: 题目:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or anothe... 阅读全文
posted @ 2014-07-26 10:31 爱做饭的小莹子 阅读(1235) 评论(0) 推荐(1) 编辑
摘要: String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全)简要的说, String 类型和 StringBuffer 类型的主要性能区别其实在于 String 是不可变的对象, 因此在每次对 String 类型进行改变的时候其实都等同... 阅读全文
posted @ 2014-07-26 10:19 爱做饭的小莹子 阅读(659) 评论(0) 推荐(1) 编辑
摘要: 题目:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:D... 阅读全文
posted @ 2014-07-26 10:09 爱做饭的小莹子 阅读(5657) 评论(1) 推荐(1) 编辑
摘要: 题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the... 阅读全文
posted @ 2014-07-26 05:28 爱做饭的小莹子 阅读(3173) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题解:这道题可以应用之前解过的Largetst Recta... 阅读全文
posted @ 2014-07-26 05:08 爱做饭的小莹子 阅读(2549) 评论(0) 推荐(0) 编辑
摘要: 题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the ... 阅读全文
posted @ 2014-07-26 04:13 爱做饭的小莹子 阅读(2222) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in t... 阅读全文
posted @ 2014-07-26 03:51 爱做饭的小莹子 阅读(5736) 评论(0) 推荐(0) 编辑
摘要: 题目:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get ... 阅读全文
posted @ 2014-07-26 03:18 爱做饭的小莹子 阅读(9561) 评论(1) 推荐(2) 编辑