
LeetCode
文章平均质量分 77
dongwanpeng00
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Arithmetic Slices --leetcode
#include <iostream> #include <vector> using namespace std; int numberOfArithmeticSlices1(vector<int>& A) { vector<int> vec(A.size() - 2, 0); for (int i = 2; i < A.size...原创 2018-04-12 15:50:23 · 229 阅读 · 0 评论 -
Min Cost Climbing Stairs
//第一种方法:递归实现,代码简单,时间复杂高。 class Solution { public: int solve(int index, vector<int>&cost){ if (index <= 1){ return 0; } return min(solve(index - 1, cost) + cost[index - 1], solv...原创 2018-04-13 18:14:39 · 258 阅读 · 0 评论 -
Best Time to Buy and Sell Stock
// 太暴力了!!! int maxProfit1(vector<int>& prices) { int diff = 0, maxdiff = INT_MIN; for (unsigned int i = 0; i <= prices.size() - 2; i++){ for (unsigned int j = 0; j <= prices.siz...原创 2018-04-13 19:19:51 · 236 阅读 · 0 评论