摘要:
贪心。 class Solution { public: int maxProfit(vector<int>& prices) { int now=prices.front(); //现在手中买入价 int profit=0; prices.push_back(prices.back()); for 阅读全文
posted @ 2021-06-10 19:16
wegret
阅读(29)
评论(0)
推荐(0)
摘要:
贪心+栈。 int cnt[5]; int l[10007],t=0; class Solution { public: bool isValid(string s) { cnt[1]=0,cnt[2]=0,cnt[3]=0; int lim=s.size(); for (int i=0;i<lim 阅读全文
posted @ 2021-06-10 18:10
wegret
阅读(44)
评论(0)
推荐(0)
摘要:
暴力解法 class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { for (int i=0;i<nums.size();i++) for (int j=i+1;j<nums.size();j++) if 阅读全文
posted @ 2021-06-10 15:49
wegret
阅读(32)
评论(0)
推荐(0)

浙公网安备 33010602011771号