摘要:
##088. 爬楼梯的最少成本 class Solution { public: int minCostClimbingStairs(vector<int>& cost) { int n=cost.size(); vector<int>f(n+1); f[0]=cost[0],f[1]=cost[1 阅读全文
posted @ 2022-03-25 20:22
liv_vil
阅读(25)
评论(0)
推荐(0)
摘要:
##068. 查找插入位置 class Solution { public: int searchInsert(vector<int>& nums, int target) { int l=0,r=nums.size(); nums.push_back(1000000);//一定有数比target大 阅读全文
posted @ 2022-03-25 18:43
liv_vil
阅读(20)
评论(0)
推荐(0)
摘要:
##059. 数据流的第 K 大数值 class KthLargest { public: priority_queue<int,vector<int>,greater<int>>heap;//小根堆 维护第1大到第k大的数 top就是第k大的数 int k;//太妙了 /* 第n大 n-1 n-2 阅读全文
posted @ 2022-03-25 15:48
liv_vil
阅读(21)
评论(0)
推荐(0)