摘要: 738 单调递增的数字 class Solution { public: int monotoneIncreasingDigits(int n) { string str = to_string(n); int flag = str.size(); for(int i = flag - 1; i > 阅读全文
posted @ 2024-10-12 22:06 ikun1111 阅读(9) 评论(0) 推荐(0)
摘要: 452 用最少数量的箭引爆气球 class Solution { public: static bool cmp(const vector &left, const vector &right) { return left[0] < right[0]; } int findMinArrowShots 阅读全文
posted @ 2024-10-12 22:03 ikun1111 阅读(16) 评论(0) 推荐(0)
摘要: 134 加油站 class Solution { public: int canCompleteCircuit(vector& gas, vector& cost) { int currentsum = 0; int totalsum = 0; int start = 0; for(int i = 阅读全文
posted @ 2024-10-12 21:55 ikun1111 阅读(7) 评论(0) 推荐(0)
摘要: 122 买股票最大时机II class Solution { public: int maxProfit(vector& prices) { vector<vector> dp(prices.size(), vector(2,0)); dp[0][0] = -prices[0]; dp[0][1] 阅读全文
posted @ 2024-10-12 21:45 ikun1111 阅读(13) 评论(0) 推荐(0)
摘要: 分发饼干 class Solution { public: int findContentChildren(vector& g, vector& s) { sort(g.begin(), g.end()); sort(s.begin(), s.end()); int count = 0; int i 阅读全文
posted @ 2024-10-12 21:34 ikun1111 阅读(24) 评论(0) 推荐(0)