- 博客(9)
- 收藏
- 关注
原创 LeetCode - Maximum Gap 题解
Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Try to solve it in linear time/space. Return 0 if the array contains less than 2 elements
2015-01-27 12:56:06 349
原创 LeetCode - Gas Station 题解
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to
2015-01-26 22:42:08 279
原创 LeetCode - Palindrome Partitioning II 题解
Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = "aab", Retu
2015-01-26 21:34:54 245
原创 LeetCode - Word Ladder II 题解
Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that: Only one letter can be changed at a timeEach intermediate word must exi
2015-01-25 13:57:50 448
原创 LeetCode - Word Ladder 题解(各种最短路算法)
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that: Only one letter can be changed at a timeEach intermediate word m
2015-01-24 10:01:35 762
原创 LeetCode - Binary Tree Maximum Path Sum 题解
Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / \ 2 3 Return 6.
2015-01-23 14:12:26 300
原创 LeetCode - Best Time to Buy and Sell Stock III 题解
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: You ma
2015-01-23 13:41:34 327
原创 LeetCode - Maximal Rectangle 题解
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 思路: 用A[i][j]表示从i,j向上有多少个连续的1,之后可以转换成Largest Rectangle in Histogram
2015-01-20 22:14:14 326
原创 LeetCode - Largest Rectangle in Histogram 题解
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 where width o
2015-01-20 21:38:23 368
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人