& IPO
题目 376
Aofisaif theand . The first(if one ) may beor . Awith fewer than twoisa.
For , [1,7,4,9,2,5] is athe(6,-3,5,-7,3) areand . In , [1,4,7,2,5] and [1,7,4,5,5] are not, the firstits first twoareand theits lastis zero.
Given aof ,theof thethat is a. Aisbysomeof(, also zero) from the,thein theirorder.
解答
class Solution {public:int wiggleMaxLength(vector
以上是高票答案 , 自己写的代码如下
class Solution {public:int wiggleMaxLength(vector
题目 502 IPO
文章插图
Hard
will start its IPO soon. In order to sell a good price of itsto,would like to work on sometoitsthe IPO. Since it has, it can onlyat most kthe IPO. Helpthe best way toits totalafterat most k.
You are given. For eachi, it has a purePi and aof Ci isto start the. , you have W . When youa , you willits pureand thewill be added to your total .
To sum up, pick a list of at most kfrom giventoyour final , andyour final.
1:
Input: k=2, W=0, =[1,2,3], =[0,1,1].
【题目 376 Wiggle Subsequence】: 4
: Since youris 0, you can only start the0.
Afterit you will1 and your1.
With1, you canstart the1 or the2.
Since you canat most 2 , you need tothe2 to get the.
文章插图
,the final, which is 0 + 1 + 3 = 4.
Note:
You mayallin the input are non- .
Theofarray andarray will not50,000.
Theisto fit in a 32-bit.
解答
class Solution {public:int findMaximizedCapital(int k, int W, vector
附录高票答案:
int findMaximizedCapital(int k, int W, vector
分析
解答参考了高票答案 , 路漫漫其修远兮 。针对C++新的功能和容器 , 自己仍然缺乏灵活应用的经验 。套路不够多哦 。
- 从低效到高效 马踏棋盘
- buuoj 篱笆墙的影子 writeup
- BUUCTF Crypto 3
- 题目链接
- 认老大的区分方式 并查表
- 迷离傍地走
- 概率公式 华东理工月赛 - 站军姿
- 1923: 【入门】墨汁
- 数学建模作业一
- web进阶