自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(476)
  • 资源 (5)
  • 收藏
  • 关注

原创 我的Github博客首页

https://github.com/sunherb

2024-02-14 20:33:17 100

原创 Leetcode 2342. 数位和相等数对的最大和 哈希+数位DP

43 – 4 + 3 == 7 || 7自己。最终因为 54 > 50 所以输出 54。

2023-11-18 10:19:20 160

原创 Jenkins自动化部署流程

General(基础配置) —> 源码管理 —> 构建触发器 —> 构建环境 —> 构建 —> 构建后操作。4.填写构建语句(shell脚本),实现自动部署。记得修改权限使用 chmod 语句。1.创建jenkins任务。2.填写Server信息。

2023-11-11 10:32:31 103

原创 Git常用的命令操作三

【代码】Git配置的命令操作。

2023-11-10 17:27:24 105

原创 Git学习常用命令二

新建git 仓库: git init关联远程仓库关联多个远程仓库忘记关联后面加 origin https://www.XXXXXX.com远程仓库克隆到本地修改的信息。

2023-11-10 17:14:20 409

原创 Git基础知识学习常用命令一

git

2023-11-10 11:05:37 355

原创 matlab图像识别一

图像识别

2022-10-24 10:20:47 972 1

原创 leetcode 715. Range 模块 (hard)

715. Range 模块

2022-06-20 09:50:43 142

原创 417. 太平洋大西洋水流问题 leetcode

思路:从四个边界,逆流往上寻找标记的思路class Solution {public: vector<vector<int>> pacificAtlantic(vector<vector<int>>& matrix) { vector<vector<int>> res; if(matrix.empty()) return res; m = matrix.size()..

2022-04-27 09:34:05 286

原创 139. 单词拆分 leetcode

class Solution {public: bool wordBreak(string s, vector<string>& wordDict) { vector<bool> dp(s.size()+1,false); unordered_set<string> m(wordDict.begin(), wordDict.end()); dp[0] = true; for(int i ..

2022-04-13 22:17:05 233

原创 804. 唯一摩尔斯密码词 leetcode

class Solution { static array<const string , 26> ops;public: int uniqueMorseRepresentations(vector<string>& words) { unordered_set<string> pool; for(auto && s:words){ string tmp = {};

2022-04-10 08:14:04 277

原创 780. 到达终点 leetcode (剪枝 + 思路巧妙)

思路分析:这道题确实非常妙!大部分的人一般都会惯性思维死劲想着怎么从(sx, sy)推到(tx, ty),蛋式由于可以变换的情况非常多,特别是当起点与终点的差距比较大的时候。如果我们逆向思考呢,从(tx, ty)推到(sx, sy),则时只能有一种操作,就是将tx、ty中较大值减去较小值(因为顺推的时候是(x, y)可以转换到 (x, x+y) 或者 (x+y, y),则逆推的时候只能将较大者减去较小者),这样思维方式确实很妙!加上三处 剪枝效果更佳class Solution {public.

2022-04-09 08:56:59 142

原创 307. 区域和检索 - 数组可修改 leetcode 模拟

class NumArray {public: int *tree; int n; NumArray(vector<int>& nums) { n = nums.size(); tree = new int [2*n]; int i, j; for(i = n; i < 2 * n; i++, j++) tree[i] = nums[j]; for(j = n - 1; j > 0; j--)..

2022-04-04 19:44:06 343

原创 leetcode 420. 强密码检验器 ( hard 模拟)

class Solution: def strongPasswordChecker(self, password: str) -> int: n = len(password) if n < 3: return 6 - n flag1 = False # 是否出现了小写字母 flag2 = False # 是否出现了大写字母 flag3 = False # 是否..

2022-04-02 21:08:37 429

原创 leetcode 计算器(不使用eval库函数)

class Solution {public: int calculate(string s) { stack<int> sta; char c = '+'; int num = 0; for(int i = 0; i <= s.length(); i++){ if(isdigit(s[i])){ num = num * 10 + (s[i] - '0');

2022-03-26 15:44:23 268

原创 leetcode 数组中第K大的数字(小根堆裸题)

这道题 用快排速度不如用堆 简单易用class Solution {public: int findKthLargest(vector<int>& nums, int k) { priority_queue<int, vector<int>, greater<int>> q; for(auto num : nums){ q.push(num); while(.

2022-03-24 14:56:46 100

原创 Leetcode 61.旋转链表

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(nex..

2022-03-22 15:13:00 543

原创 leetcode 2038. 如果相邻两个颜色均相同则删除当前颜色(博弈)

class Solution {public: bool winnerOfGame(string colors) { //遍历一遍判断有多少个满足的可删除的点就行了 int sum = 0; for(int i = 1;i < colors.size()-1;i++){ if(colors[i-1] == 'A'&&colors[i] == 'A'&&colors[i+1] == 'A..

2022-03-22 14:54:57 304

原创 剑指 Offer 55 - I. 二叉树的深度 (入门)

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: int maxDepth(TreeNode* root) {.

2022-03-21 20:37:28 536

原创 剑指 Offer 54. 二叉搜索树的第k大节点

class Solution { private int ans = 0, cnt = 0; private void dfs(TreeNode root , int k){ if(root == null) return ; dfs(root.right, k); if(++cnt == k){ ans = root.val; } dfs(root.l..

2022-03-21 20:11:07 319

原创 剑指 Offer II 115. 重建序列

class Solution {public: bool sequenceReconstruction(vector<int>& org, vector<vector<int>>& seqs) { if (seqs.size() == 0) return false; int len = org.size(); vector<vector<int>&...

2022-03-18 19:17:29 393

原创 leetcode 4. 寻找两个正序数组的中位数(二分加速)

有点慢class Solution {public: int findKth(vector<int>& nums1,int i, vector<int>& nums2, int j, int k){ if(i >= nums1.size()) return nums2[j + k - 1]; if(j >= nums2.size()) return nums1[i + k - 1].

2022-03-16 15:55:03 317

原创 leetcode 50.第一个只出现一次的字符(unordered_map)

unordered_map 的常规使用class Solution {public: char firstUniqChar(string s) { unordered_map<char,int> t; for(char c : s) t[c]++; for(char c:s) if(t[c] == 1) return c; return ' '; }};...

2022-03-16 15:41:02 582

原创 leetcode 136. 只出现一次的数字(位运算)

异或位运算class Solution {public: int singleNumber(vector<int>& nums) { return accumulate(nums.begin(),nums.end(),0,bit_xor()); }};class Solution {public: int singleNumber(vector<int>& nums) { int res = 0;.

2022-03-15 17:58:56 361

原创 leetcode 344. 反转字符串

普通解法:class Solution {public: void reverseString(vector<char>& s) { for(int i = 0, j = s.size() - 1; i < s.size() / 2; i++, j--){ swap(s[i],s[j]); } }};一个思路比较好的解法源于swap() 的两种实现方法一种通过变量交换地址另一种通过位运算s[.

2022-03-15 16:53:03 367

原创 leetcode 1984. 学生分数的最小差值

class Solution {public: void qs(vector<int>& nums, int left,int right){ if(left >= right){ return ; } int x = nums[left + (right - left) / 2], i = left - 1, j = right + 1; while(i < j){ .

2022-03-15 16:44:54 187

原创 Leetcode 219. 存在重复元素 II

class Solution {public: bool containsNearbyDuplicate(vector<int>& nums, int k) { if(nums.size()<2) return false; int size = nums.size(); int left = 0, right = 0; /// 创建一个窗口 unordered_map<int,int&.

2022-03-15 16:17:12 396

原创 Leetcode 543. 二叉树的直径

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} *.

2022-03-15 10:45:14 560

原创 Leetcode 43. 字符串相乘

class Solution {public: string multiply(string num1, string num2) { int n1= num1.size(), n2 = num2.size(); string ret(n1 + n2, '0'); int start = 0; for(int j = n2 - 1; j >= 0; --j){ int k = start; .

2022-03-14 19:16:16 199

原创 剑指 Offer II 007. 数组中和为 0 的三个数

class Solution {public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> ans; sort(nums.begin(), nums.end()); int n = nums.size(); for(int i = 0; i < n - 2; i++.

2022-03-14 16:19:06 102

原创 剑指 Offer 11. 旋转数组的最小数字 (二分)

部分有序降低时间复杂度class Solution {public: int minArray(vector<int>& numbers) { int l = 0, r = numbers.size() - 1; while(l <= r){ int m = l + (r - l) / 2; if(numbers[m] > numbers[r]) l = m .

2022-03-14 10:41:44 376

原创 Leetcode 347. 前 K 个高频元素

本题目其实是找众数,可以利用桶排序,但是运用堆排序+优先队列可能效率更高一些class Solution {public: vector<int> topKFrequent(vector<int>& nums, int k) { using E = std::paira<int, int>; std::priority_queue<E, std::vector<E>, std::greater<E&.

2022-03-09 19:07:27 81

原创 不相交的线(DP) Leetcode

class Solution {public: int maxUncrossedLines(vector<int>& nums1, vector<int>& nums2) { int m = nums1.size(); int n = nums2.size(); vector<vector<int>> dp((m+1), vector<int>(n+1)); for(int i = 1;..

2022-02-28 11:04:37 150

原创 177. 第N高的薪水 Leetcode

DECLARE m INT;SET m = N - 1;RETURN(SELECT ifnull((SELECT DISTINCT salary FROM Employee ORDER BY salary DESC LIMIT m, 1),NULL));END

2022-02-28 10:21:53 114

原创 11. 盛最多水的容器 Leetcode

class Solution {public:int maxArea(vector& height) {if(height.size() <= 1) return -1;int i = 0, j = height.size() - 1, res = 0;while(i < j){int h = min(height[i], height[j]);res = max(res, h * (j - i));if(height[i] < height[j]) ++i;e.

2022-02-27 22:08:45 120

原创 Leetcode 75. 颜色分类

class Solution {public: void sortColors(vector<int>& nums) { int r1 = -1; int r2 = -1; int n = nums.size(); for(int i = 0; i < n; i++){ if(nums[i] < 2){ r2++; swap(nums,i,r2); .

2022-02-25 23:20:53 175

原创 删除链表的倒数第 N 个结点

// 递归写法class Solution {public: int cur = 0; ListNode* removeNthFromEnd(ListNode* head, int n) { if(!head) return NULL; head -> next = removeNthFromEnd(head->next,n); cur++; if(n == cur) return head->next; re.

2022-02-25 18:35:05 177

原创 爬楼梯的三种解法

1.递归int climbStairs(int n) { int p = 0, q = 0, r = 1; for (int i = 1; i <= n; ++i) { p = q; q = r; r = p + q; } return r;}2.快速幂class Solution {public: vector<vector<long long>> multiply(ve.

2022-02-22 15:44:10 183

原创 将三个线程 循环打印三次

将三个线程 循环打印三次用到了c++函数库里面的阻塞函数和notify_all()函数#include <iostream>#include <condition_variable>#include <thread>std::mutex mtx;std::condition_variable cv;int ready = 0;void PrintString_1(){ std::unique_lock<std::mutex>

2022-02-18 21:13:16 308

原创 海量数据的查询优化

mysql数据量大时使用limit分页,随着页码的增大,查询效率越低下。For example:1.直接使用用limit start, count分页语句:select * from order limit start, countselect * from order limit 10, 20 0.016秒select * from order limit 100, 20 0.016秒select * from order limit 1000, 20 0.047秒select * from

2022-02-18 21:03:56 338

git工具之git-extension

git工具更加方便管理git版本 git-extension

2023-11-14

ChineseNumberIdentify-master.zip

通过Python语言,机器学习技术,识别汉字数字 通过Python语言,机器学习技术,识别汉字数字 通过Python语言,机器学习技术,识别汉字数字

2020-06-11

事件驱动大作业.zip

Zork_SDUT_2020

2020-06-11

海外名校计算机网络习题答案.pdf

海外名校计算机网络习题答案.pdf

2020-05-09

国外计算机网络习题整理.pdf

国外计算机网络习题整理.pdf

2020-05-09

计算机网络超全笔记.pdf

重要的事情说三遍!!! 这是计算机网络超全笔记,包括了考研重点,覆盖知识点全面且有重点,详略得当,亲自总结手打的!

2020-05-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除