摘要: 此题属于固定题,没法扩展。 class Solution { public: vector<int> findDiagonalOrder(vector<vector<int>>& mat) { int m = mat.size(); if (m == 0) return {}; int n = ma 阅读全文
posted @ 2021-08-19 15:17 三一一一317 阅读(54) 评论(0) 推荐(0)
摘要: 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)