上一页 1 2 3 4 5 6 7 8 ··· 23 下一页
摘要: class Solution { public: bool canMeasureWater(int jug1Capacity, int jug2Capacity, int targetCapacity) { // 两个水壶的容量之和小于目标,肯定不能得到目标值 if(jug1Capacity + j 阅读全文
posted @ 2021-08-19 14:34 三一一一317 阅读(69) 评论(0) 推荐(0)
摘要: class Solution { public: bool canFinish(int numCourses, vector<vector<int>>& prerequisites) { if(numCourses==0) return false; vector<vector<int>> edge 阅读全文
posted @ 2021-08-19 14:09 三一一一317 阅读(102) 评论(0) 推荐(0)
摘要: class Solution { public: static bool cmp(vector<int> &a, vector<int> &b){ if(a[0]!=b[0]) return a[0]<b[0]; else return a[1]<b[1]; } int maxEvents(vect 阅读全文
posted @ 2021-08-19 12:52 三一一一317 阅读(49) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-08-19 10:20 三一一一317 阅读(50) 评论(0) 推荐(0)
摘要: class Solution { public: int nthUglyNumber(int n) { int a = 0; int b = 0; int c = 0; vector<int> res(n,1); for(int i = 1; i < n; i++){ int temp = min( 阅读全文
posted @ 2021-08-18 21:36 三一一一317 阅读(36) 评论(0) 推荐(0)
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), rig 阅读全文
posted @ 2021-08-18 15:03 三一一一317 阅读(132) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> res; vector<vector<int>> permute(vector<int>& nums) { vector<int> temp; for(int i = 0; i < nums.size(); i 阅读全文
posted @ 2021-08-18 14:59 三一一一317 阅读(45) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-08-18 14:58 三一一一317 阅读(51) 评论(0) 推荐(0)
摘要: 参考: https://leetcode-cn.com/problems/factorial-trailing-zeroes/solution/xiang-xi-tong-su-de-si-lu-fen-xi-by-windliang-3/ class Solution { public: int 阅读全文
posted @ 2021-08-18 14:56 三一一一317 阅读(47) 评论(0) 推荐(0)
摘要: 三面列举了三种不同最小值所在的位置,可以看出只要当前元素为1,那么dp[i][j]就等于左上,左、上,中的最小值加1。 比如图一种最小值为3。问号所在位置元素为1,那么dp问号处的值就为4,因为当取三者最小值的时候,其余两个4,4所在位置的元素肯定为1。不然此处的dp值肯定比3还小。 class S 阅读全文
posted @ 2021-08-18 13:54 三一一一317 阅读(52) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 23 下一页