09 2021 档案
摘要:class Solution { public: int longestConsecutive(vector<int>& nums) { if(nums.size()==0) return 0; sort(nums.begin(), nums.end()); // 去除重复元素, 不然遇到0 1 1
阅读全文
摘要:class Solution { public: int getSum(int a, int b) { while(b!=0){ // 进位为0的时候停止 // 注意这个unsigned int 很重要 unsigned int carry = (unsigned int) (a&b)<<1; //
阅读全文
摘要:class Solution { public: // 字符串分割 vector<string> spltstr(string s){ vector<string> res; string tmp; for(auto c: s){ if(c!=' ') tmp = tmp + c; else if(
阅读全文
摘要:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) :
阅读全文
摘要:/* dp[i]表示以i下标结尾的最长严格递增子序列的长度,需要注意的是最后算出来的dp[i]才是以i下标结尾的 最长严格递增子序列的长度,中间运行过程中dp[i]并不是以i结尾的最长严格递增子序列的长度, 而是以i结尾的递增子序列的长度。 cnt[i]为考虑以nums[i]结尾的最长上升子序列的个
阅读全文
摘要:单源最短路径,其实就是求某个节点到其他所有节点中路径的最大值 class Solution { public: void dijkstra(vector<vector<int>>& w, int k, int n,vector<bool>& vis,vector<int>& dist) { // 只
阅读全文
摘要:示例: 输入: [[100, 200], [200, 1300], [1000, 1250], [2000, 3200]] 输出: 3 解释: 这里一共有 4 门课程, 但是你最多可以修 3 门: 首先, 修第一门课时, 它要耗费 100 天,你会在第 100 天完成, 在第 101 天准备下门课。
阅读全文
摘要:示例 2: 输入: 4, [[1,0],[2,0],[3,1],[3,2]] 输出: [0,1,2,3] or [0,2,1,3] class Solution { public: vector<int> findOrder(int numCourses, vector<vector<int>>&
阅读全文
摘要:class Solution { public: bool isBipartite(vector<vector<int>>& graph) { int n = graph.size(); if(n==0) return true; queue<int> q; vector<int> color(n,
阅读全文
摘要:Amazon - 北京/上海 AMD - 上海 Airbnb - 北京 Apple - 北京/上海 ArcSoft - 杭州 Autodesk - 北京/上海 Booking - 上海 Citrix - 南京 Cisco - 北京/上海/杭州/苏州 Coolapk (酷安) - 北京/深圳 Coup
阅读全文
摘要:1. 显示.git目录:$ defaults write com.apple.finder AppleShowAllFiles TRUE 2. 隐藏.git目录:$ defaults write com.apple.finder AppleShowAllFiles FALSE 3. 重启Finder
阅读全文
摘要:链接: https://www.nowcoder.com/test/question/908255677b6f4c18a9074c12f21acd59?pid=28083344&tid=47458050 现在有n个物品,每一个物品都有一个价值,现在想将这些物品分给两个人,要求这两个人每一个人分到的物
阅读全文
摘要:https://blog.csdn.net/mengyujia1234/article/details/90179896
阅读全文

浙公网安备 33010602011771号