摘要: class Solution { public: bool isValid(string s) { int len = s.length(); if(len==0) return true; vector<char> res; if(s[0]==')'||s[0]==']'||s[0]=='}') 阅读全文
posted @ 2021-07-15 15:32 三一一一317 阅读(26) 评论(0) 推荐(0)
摘要: class Solution { public: vector<string> res; unordered_map<char,string> map; string str = ""; vector<string> letterCombinations(string digits) { int l 阅读全文
posted @ 2021-07-15 13:39 三一一一317 阅读(31) 评论(0) 推荐(0)
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : 阅读全文
posted @ 2021-07-15 12:25 三一一一317 阅读(37) 评论(0) 推荐(0)
摘要: class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> res; if(nums.size()<3) return res; sort(nums.begin(), n 阅读全文
posted @ 2021-07-15 11:32 三一一一317 阅读(31) 评论(0) 推荐(0)
摘要: class Solution { public: int maxArea(vector<int>& height) { int i = 0; int j = height.size()-1; int res = -1; while(i<j){ res = max(res,min(height[j], 阅读全文
posted @ 2021-07-14 19:01 三一一一317 阅读(24) 评论(0) 推荐(0)
摘要: 注意这题求的是子串不是子序列 class Solution { public: string longestPalindrome(string s) { if(s.size()<2) return s; int len = s.length(); int maxlen = 1; int start 阅读全文
posted @ 2021-07-14 17:41 三一一一317 阅读(24) 评论(0) 推荐(0)
摘要: \ 此题与之前在一个数组中找中位数类似,可以在基础上修改。 不过在入堆的时候需要对两个数组大小元素进行判断,小的入堆。 class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nu 阅读全文
posted @ 2021-07-14 15:28 三一一一317 阅读(44) 评论(0) 推荐(0)
摘要: class Solution { public: int lengthOfLongestSubstring(string s) { if(s.length()==0) return 0; vector<int> dp(s.size(),0); dp[0] = 1; // 初始状态。 // dp[i] 阅读全文
posted @ 2021-07-13 13:16 三一一一317 阅读(31) 评论(0) 推荐(0)
摘要: 首先在官网下载指定版本opencv源码: https://opencv.org/releases/ cd ~/opencv #此处为opencv的解压文件目录 mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTAL 阅读全文
posted @ 2021-07-10 20:26 三一一一317 阅读(229) 评论(0) 推荐(0)
摘要: 1 常量的定义方式 一:define定义的宏常量 二:const 修饰的变量 #define 常量名 常量值 const 类型 常量名 常量值 变量前加const关键字变成常量,不可更改。 阅读全文
posted @ 2021-07-10 19:53 三一一一317 阅读(37) 评论(0) 推荐(0)