![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode oj
文章平均质量分 82
shuizhilei3334
这个作者很懒,什么都没留下…
展开
-
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 it原创 2014-10-07 17:00:53 · 383 阅读 · 0 评论 -
[leetcode oj]Maximum Product Subarray
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the larg原创 2015-01-21 12:51:16 · 464 阅读 · 0 评论 -
[leetcode oj]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 vertica原创 2015-01-20 10:54:06 · 362 阅读 · 0 评论 -
[leetcode oj] LRU
#include #include #include using namespace std; class LRUCache{ public: unordered_map::iterator> m; list priority; int cap; int size; LRUCache(int capacity) { cap = capacity; size = 0; }原创 2015-01-18 15:18:53 · 406 阅读 · 0 评论 -
[leetcode]Longest Valid Parentheses
题目:Longest Valid Parentheses Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()", the longest valid paren原创 2015-01-29 13:28:27 · 347 阅读 · 0 评论 -
[leetcode] best time to buy and sell stock
题目:The best time to buy and sell stock (I) (II) (III) 题目描述: 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原创 2014-10-14 16:55:04 · 538 阅读 · 0 评论 -
[leetcode] wordBreak II
[题目]Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s原创 2014-10-16 09:46:11 · 421 阅读 · 0 评论 -
[leetcode] Sort List
题目描述:Sort a linked list in O(n log n) time using constant space complexity原创 2014-10-13 13:07:52 · 420 阅读 · 0 评论 -
[leetcode] distinct sequences
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none原创 2014-10-08 16:46:34 · 592 阅读 · 0 评论 -
Best Time to Buy and Sell Stock IV
题目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 k transactions.分析题目大意如下: 给定一个数组,这个数组记录原创 2015-03-08 10:50:40 · 393 阅读 · 0 评论