摘要:```c++ class Solution { public: int rob(vector& nums) { int len = nums.size(); if(!len) return 0; if(len == 1) return nums[0]; std::vector mem(len,0);
阅读全文
摘要:```c++ / @lc app=leetcode id=174 lang=cpp [174] Dungeon Game https://leetcode.com/problems/dungeon game/description/ algorithms Hard (26.59%) Total Ac
阅读全文
摘要:"原题链接" 讨论区的人才有更好的解决方案,利用 STL 的 lower_bound 函数,效率提升不少。
阅读全文
摘要:```c++ / @lc app=leetcode id=62 lang=cpp [62] Unique Paths https://leetcode.com/problems/unique paths/description/ algorithms Medium (46.62%) Total Ac
阅读全文
摘要:```c++ class Solution { public: int maxProfit(vector& prices) { if(prices == nullptr || prices.size() max_profit) max_profit = prices[j] prices[i]; }
阅读全文
摘要:```C++ / @lc app=leetcode id=17 lang=cpp [17] Letter Combinations of a Phone Number https://leetcode.com/problems/letter combinations of a phone numbe
阅读全文