自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 215. Kth Largest Element in an Array(heap)

题目:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, r

2016-09-24 21:10:58 276

原创 207. Course Schedule(gragh)

题目:There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expr

2016-09-23 23:40:10 235

原创 71. Simplify Path(stack)

题目:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"简化路径,规则:..返回一级目录.无效运用stack记录路径public clas

2016-09-23 22:06:07 163

原创 23. Merge k Sorted Lists(heap)

题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个有序链表创建一个大小为K的堆,每次取出对顶元素,然后添加堆顶元素在原链表的下一个元素。最后取出的元素形成的链表就是有序链表 public Lis

2016-09-23 18:16:38 231

原创 212. Word Search II(Trie)

题目:Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are

2016-09-23 17:04:21 236

原创 208. Implement Trie (Prefix Tree)(Trie)

题目:Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.实现字典树,用hashmap来存储,key为当前字符,value为子树class Tr

2016-09-23 15:38:06 175

原创 87. Scramble String(dfs+剪枝)

题目:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great /

2016-09-21 12:03:42 171

原创 97. Interleaving String(dp)

题目:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbba

2016-09-21 09:51:05 180

原创 123. Best Time to Buy and Sell Stock III(dp)

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:

2016-09-20 17:22:56 147

原创 122. Best Time to Buy and Sell Stock II(贪心)

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i

2016-09-20 16:55:28 182

原创 121. Best Time to Buy and Sell Stock(贪心)

题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th

2016-09-20 16:48:10 187

原创 85. Maximal Rectangle(dp)

题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1

2016-09-20 16:35:58 253

原创 84. Largest Rectangle in Histogram(dp)

题目: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 histogram.Above is a histogram wher

2016-09-19 20:15:06 249

原创 79. Word Search

题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or v

2016-09-19 17:34:08 135

原创 37. Sudoku Solver(dfs)

题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()",

2016-09-19 16:56:29 201

原创 22. Generate Parentheses(dfs)

题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()",

2016-09-19 15:40:43 151

原创 40. Combination Sum II

题目:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in th

2016-09-10 16:57:49 121

原创 39. Combination Sum

题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlim

2016-09-10 16:34:39 157

原创 93. Restore IP Addresses(dfs+剪枝)

题目:Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given "25525511135",return ["255.255.11.135", "255.255.111.35"]

2016-09-09 20:13:15 206

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除