摘要:
121. 买卖股票的最佳时机 class Solution { public: int maxProfit(vector<int>& prices) { int less=2e5+100; int ans=0; for(int i=0;i<prices.size();i++) { less=min( 阅读全文
posted @ 2020-06-02 22:25
branna
阅读(219)
评论(0)
推荐(0)
摘要:
714. 买卖股票的最佳时机含手续费 dp[i][0]表示手上没有股票,一个是之前没有股票,一个是之前有股票然后卖掉了 dp[i][1]表示手上有股票,一个是之前有股票,一个是之前没有股票,然后买了 class Solution { public: int maxProfit(vector<int> 阅读全文
posted @ 2020-06-02 21:47
branna
阅读(189)
评论(0)
推荐(0)
摘要:
1414. 和为 K 的最少斐波那契数字数目 class Solution { public: int findMinFibonacciNumbers(int k) { //unsigned long long f[92]; f[1]=1;f[2]=1; if(k==1) return 1; int 阅读全文
posted @ 2020-06-02 15:47
branna
阅读(211)
评论(0)
推荐(0)
摘要:
62. 不同路径 class Solution { public: int uniquePaths(int m, int n) { int dp[105][105]; for(int i=0;i<m;i++) for(int j=0;j<n;j++) dp[i][j]=0; dp[0][1]=1; 阅读全文
posted @ 2020-06-02 14:24
branna
阅读(201)
评论(0)
推荐(0)
摘要:
1051. 高度检查器 class Solution { public: int heightChecker(vector<int>& heights) { int bb[1000]; for(int i=0;i<heights.size();i++) bb[i]=heights[i]; sort( 阅读全文
posted @ 2020-06-02 13:58
branna
阅读(151)
评论(0)
推荐(0)
摘要:
1144. 递减元素使数组呈锯齿状 class Solution { public: int movesToMakeZigzag(vector<int>& nums) { int ji=0; int n=nums.size(); if(n==1) return 0; if(n==2&&nums[0] 阅读全文
posted @ 2020-06-02 13:24
branna
阅读(270)
评论(0)
推荐(0)
摘要:
面试题 16.04. 井字游戏 一开始以为让我往里面放,结果是直接判断该局面谁赢了。。。 class Solution { public: string tictactoe(vector<string>& board) { int n=board.size(); bool flag=false; f 阅读全文
posted @ 2020-06-02 11:32
branna
阅读(623)
评论(0)
推荐(0)

浙公网安备 33010602011771号