自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(29)
  • 收藏
  • 关注

转载 解决IDEA和输入法切换快捷键Ctrl+Space(空格)冲突导致无法显示代码提示

解决IDEA和输入法切换快捷键Ctrl+Space(空格)冲突导致无法显示代码提示(无需修改注册表以及添加其他输入法)转载了这篇博文链接

2022-04-07 20:04:21 1861

原创 手动打开MySQL80服务的方法

手动打开MySQL80服务的方法键盘Windows + R,输入services.msc然后回车,打开一下服务页面;找到MySQL80,右键手动打开

2022-01-06 19:09:20 1029

原创 windows环境本地MySQL忘记密码的重置方法

windows环境本地MySQL忘记密码的重置方法可以参考这篇博文而笔者的解决方案是直接修改了密码??键盘Windows + R,输入services.msc然后回车,打开一下服务页面;右键MySQL80,打开属性发现竟然可以直接修改密码(不知道为什么)然后Navicat连接MySQL,输入新修改的密码,连接成功!...

2022-01-06 19:05:17 957

原创 leetcode: 383. Ransom Note

leetcode: 383. Ransom Note原题链接class Solution {public: bool canConstruct(string ransomNote, string magazine) { int mp[26] = {0}; for (char x : magazine) mp[x - 'a']++; for (char x : ransomNote) { if (m

2021-12-25 19:18:01 215

原创 leetcode: 454. 4Sum II

leetcode: 454. 4Sum II原题链接这道题目很自然的一个思路就是运用4重for循环,暴力判断,结果超时。思考改进,想到用哈希表可以把最后一次for循环省掉,优化到3重for循环,还是超时。最后优化到O(n^2)class Solution {public: int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vec

2021-12-25 19:07:23 343

原创 leetcode: 1. Two Sum

leetcode: 1. Two Sum原题链接class Solution {public: // 为了便于判断是否存在,将下标映射统一向后延后1 vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int, int> mp; for (int i = 0 ; i < nums.size(); i++) {

2021-12-14 16:51:26 916

原创 leetcode: 202. Happy Number

leetcode: 202. Happy Number原题链接class Solution {public: bool isHappy(int n) { unordered_map<int, bool> mp; while (n != 1) { mp[n] = true; int m = 0; int tmp = n; while (tmp != 0) {

2021-12-13 11:09:15 3132

原创 leetcode: 349. Intersection of Two Arrays

leetcode: 349. Intersection of Two Arrays原题链接我的写法:使用unordered_mapclass Solution {public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { vector<int> ans; unordered_map<int, bool&

2021-12-13 11:02:29 359

原创 leetcode: 242. Valid Anagram

leetcode: 242. Valid Anagram原题链接class Solution {public: bool isAnagram(string s, string t) { if (s.size() != t.size()) return false; int mp[26] = {0}; for (char x : s) { mp[x - 'a']++; } for (ch

2021-12-13 10:36:07 209

原创 leetcode: 142. Linked List Cycle II

leetcode: 142. Linked List Cycle II原题链接/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *detectCycle(ListN

2021-12-13 10:03:51 381

原创 leetcode: 面试题 02.07. Intersection of Two Linked Lists LCCI

leetcode: 面试题 02.07. Intersection of Two Linked Lists LCCI原题链接/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: List

2021-12-12 13:39:44 4496

原创 leetcode: 19. Remove Nth Node From End of List

leetcode: 19. Remove Nth Node From End of List原题链接/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} *

2021-12-12 10:43:08 310

原创 leetcode: 24. Swap Nodes in Pairs

leetcode: 24. Swap Nodes in Pairs原题链接/** * 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

2021-12-12 09:59:06 327

原创 leetcode: 206. Reverse Linked List

leetcode: 206. Reverse Linked List方法一:双指针法,不创建新的链!/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} *

2021-12-11 17:03:19 506

原创 leetcode: 707. Design Linked List

leetcode: 707. Design Linked List原题链接设置一个虚拟头结点,方便处理class MyLinkedList {public: // 定义链表结点结构体 struct LinkedNode { int val; LinkedNode* next; //LinkedNode() : val(0), next(nullptr) {} LinkedNode(int x) : val(x), nex

2021-12-11 16:37:35 230

原创 leetcode: 203. Remove Linked List Elements

leetcode: 203. Remove Linked List Elements原题链接方法一:直接使用原来的链表来进行移除节点操作:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next

2021-12-11 14:47:00 117

原创 leetcode: 59. Spiral Matrix II

leetcode: 59. Spiral Matrix II原题链接class Solution {public: vector<vector<int>> generateMatrix(int n) { vector<vector<int>> ans(n, vector<int>(n, 0)); // 定义一个二维数组,存答案 int count = 1; // 要填的数字 int mi

2021-12-10 15:40:33 312

原创 leetcode: 209. Minimum Size Subarray Sum

leetcode: 209. Minimum Size Subarray Sum原题链接解法一:暴力,时间复杂度O(n^2)class Solution {public: int minSubArrayLen(int target, vector<int>& nums) { int n = INT32_MAX; // 不可能达到的数 for (int i = 0; i < nums.size(); i++) {

2021-12-10 15:00:22 98

原创 leetcode: 977. Squares of a Sorted Array

leetcode: 977. Squares of a Sorted Array原题链接这道题目注意原数组nums[]本身是有序的,所以平方后最大的数一定是在数组的两边class Solution {public: vector<int> sortedSquares(vector<int>& nums) { vector<int> ans(nums.size(), 0); int k = nums.size() -

2021-12-10 10:59:48 103

原创 leetcode: 27. Remove Element

leetcode: 27. Remove Element方法一:暴力,时间复杂度O(n^2)class Solution {public: int removeElement(vector<int>& nums, int val) { int n = nums.size(); for (int i = 0; i < n; i++) { if (nums[i] == val) { f

2021-12-10 10:40:27 4512

原创 leetcode: 1005. Maximize Sum Of Array After K Negations(贪心)

leetcode: 1005. Maximize Sum Of Array After K Negations(贪心)原题链接class Solution {static bool cmp(int a, int b) { return abs(a) > abs(b);}public: int largestSumAfterKNegations(vector<int>& nums, int k) { sort(nums.begin(), n

2021-12-09 21:47:59 303

原创 leetcode: 367. Valid Perfect Square

leetcode: 367. Valid Perfect Square原题链接class Solution {public: bool isPerfectSquare(int num) { int left = 1; int right = num; int mid; while (left <= right) { mid = left + (right - left) / 2;

2021-12-09 14:41:49 130

原创 leetcode: 69. Sqrt(x)

leetcode: 69. Sqrt(x)原题链接题意:求满足 k * k <= x 的最大的kclass Solution {public: int mySqrt(int x) { int left = 0; int right = 46340; int mid; while (left <= right) { mid = left + (right - left) / 2;

2021-12-09 14:21:53 104

原创 leetcode :35. Search Insert Position

leetcode :35. Search Insert Position原题链接class Solution {public: int searchInsert(vector<int>& nums, int target) { int left = 0; int right = nums.size() - 1; // 左闭右闭写法 while (left <= right) { int mid =

2021-12-09 13:07:30 437

原创 leetcode: 34. Find First and Last Position of Element in Sorted Array

leetcode: 34. Find First and Last Position of Element in Sorted Arrayclass Solution {public: vector<int> searchRange(vector<int>& nums, int target) { int leftBorder = getLeftBorder(nums, target); int rightBorder = getR

2021-12-09 11:04:51 191

原创 leetcode: 704. Binary Search

704. Binary Search原题链接二分法有两种写法,分别是左闭右闭写法,和左闭右开写法。以第一种写法为例,定义待查找 target 是在一个在左闭右闭的区间里,也就是[left, right] 中,这样就知道初始条件和判断条件如何写了。class Solution {public: int search(vector<int>& nums, int target) { int left = 0; int right = nums

2021-12-07 22:44:57 438

原创 git设置代理解决Failed to connect to github.com port 443: Timed out

git设置代理Failed to connect to github.com port 443: Timed out参考了这篇博文git设置代理解决了Failed to connect to github.com port 443: Timed out问题

2021-11-04 21:55:47 770

原创 kubectl context从minikube切换为docker desktop以及查看当前context的命令行指令

在cmd中查看当前kubectl的context时,输入指令"kubectl config current-context"可以看到当前的context是minikube如果想要切换到docker desktop,那么执行指令"kubectl config use-context docker-desktop"让我们来验证下是否转换成功,再次输入"kubectl config current-context"可以看到已经切换到docker-desktop。这样就可以根据...

2021-08-09 22:00:35 616

原创 在win10家庭版中打开Hyper-V的方法

为了在win10环境中跑minikube或者Docker Desktop,必须在控制面板中打开Hyper-V,可是我们可能会发现找不到Hyper-V,这时我们可以参考这篇博文来解决https://www.cnblogs.com/guangzhou11/p/11622212.html注意运行cmd文件时会下载很多个文件,耐心等待一分钟左右就好了需要注意的是,win10家庭版打开了该功能后会和VMware冲突,如果我们要安装VMware或者使用的话,保险起见,要禁用Hyper-V来避免冲突。(遇到冲

2021-08-09 20:38:15 2259

空空如也

空空如也

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

TA关注的人

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