![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LintCode
SharonMoMo
Every thing will be okay in the end....
展开
-
[LintCode] Coins in a line II
Note: Both player are intelligent. dp[i] indicates the maximum value we can get from position i to the end of coins. There are two choices: 1st: We take only one coins which has values[i], then the原创 2015-11-09 08:33:25 · 932 阅读 · 0 评论 -
[LintCode] Continuous Subarray Sum
Given an integer array, find a continuous subarray where the sum of numbers is the biggest. Your code should return the index of the first number and the index of the last number. (If their are duplica原创 2015-11-09 10:17:53 · 433 阅读 · 0 评论 -
[LintCode] Continuous Subarray Sum II
Actually the question is like Continuous Subarray sum, but now the array becomes a circular array!! Here is a great explanation: http://www.geeksforgeeks.org/maximum-contiguous-circular-sum/So there a原创 2015-11-09 11:43:55 · 1121 阅读 · 0 评论 -
[LintCode]Maximum Subarray Difference
Solving this question by O(n) time w/ O(n) space. The basic idea is to find a appropriate cut let the difference become largest. We keep track local max, local min, left max, left min, and right min,原创 2015-11-10 17:30:15 · 685 阅读 · 0 评论 -
[LintCode] Nuts and Bolts
The question is actually a quick sort problem. The basic idea is: 1st, we pick a “nut” from nuts pile. 2nd we divide bolts into two parts according to the “nut”; 3rd we find the matching bolt 4th t原创 2015-11-11 16:18:36 · 1173 阅读 · 0 评论 -
[LintCode] Expression Evaluation
The idea is straightforward, by using two stacks, we solve this question with O(n) time and O(n) memory.Note: giving each operator a “rank” makes problem easier to be solved!!^o^class Solution {public原创 2015-11-13 15:17:42 · 435 阅读 · 0 评论 -
[LintCode] Convert Expression to Polish Notation
The basic idea is using a stack to store every operator. For parentheses, if we meet “)” we add it into stack. if we meet”(” we pop stack till we meet “)”. class Solution {public: /** * @par原创 2015-11-13 07:16:37 · 507 阅读 · 0 评论