自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Postman创建ElasticSearch索引一直在sending状态

Postman创建ElasticSearch索引一直在sending状态

2023-03-08 22:47:43 188

转载 try-catch-finally的执行顺序

try-catch-finally执行顺序

2023-03-05 15:31:16 147

转载 Mybatis下划线和实体类驼峰映射的问题

转:Mybatis下划线和实体类驼峰映射的问题在用Mybatis注解开发,查询数据库的时候,会发现数据库里是下划线的字段查出来映射到实体类的时候为空 解决这个问题有两种方式 1、使用注解 加上注解映射后,发现可以了, 但是如果字段多了的话,这种方式比较繁琐,推荐使用第二种方式 2、使用配置文件进行全局配置 可以看到所有的驼峰格式的字段有有值了,用这种方式很方便 ...

2021-10-20 13:11:10 1284 1

转载 springboot中 利用java反射调用Service,注入Dao接口为null

转:springboot中 利用java反射调用Service,注入Dao接口为null转:springboot中 利用java反射调用Service,注入Dao接口为nullspringboot 使用反射时spring注入及切面无效

2021-10-08 15:05:53 1296

转载 Mapped Statements collection already contains value for xxx

Mapped Statements collection already contains value for xxx 解决Mybatis开发过程中经常遇到Mapped Statements collection already contains value for xxx 这种错误。字面意思是说mapper中存在id重复的值,比如说同一个xml文件中有两个id为xxx的方法。这种经常是copy已有代码的时候忘了改id导致的。不过,mybatis出现这种错误时,可能实际重复的id并不是它报出来的那个,碰到

2021-09-02 16:21:35 229

转载 SpringBoot+MyBatis项目All elements are null问题

问题:相同的SQL语句在DBeaver下可以正确的查询到数据,在项目中能够查询到正确的记录条数,但是每一条都是Null,提示All elements are null解决:控制台输出如下截图从控制台输出可以看出,查询语句是有返回值的,有两行数据。 但是从PostMan中返回的结果可以看出,data均为null。 如下: 查看我们的Mapper语句 查看我们的Dao 发现以上都没有错误,我们来看看实体类。 错误的原因: 经过排查后发现,Mybatis数据库中查出来的数据的字段名,跟实体类中的属性

2021-09-02 14:20:01 852

转载 mysql中插入数据时Duplicate entry ‘‘ for key ‘PRIMARY‘的解决方案

该问题是插入数据表中遇到键重复,有三种解决方案。1.IGNOREINSERT IGNORE INTO Table_name(……) VALUES(1,1),(2,2),(3,3);使用IGNORE,如果插入的记录中存在重复值会忽略重复值的该记录行,不影响其他行的插入。2.REPLACEREPLACE INTO Table_name() VALUES(1,1),(2,2),(3,3)使用replace当插入的记录遇到主键或者唯一重复时先删除表中重复的记录行再插入3.ON DUPLICATE KE

2021-08-03 11:25:24 3589 1

转载 Word中给公式加编号,编号右对齐方法

Word中给公式加编号,编号右对齐方法

2021-04-15 19:25:49 2640

转载 word快捷键复制粘贴无法使用

解决方案:1、在需zhi要粘贴文字的Word文档中点击dao左上角的【zhuan文件】,点击左下shu角的【选项】。2、点击选项后,会弹出【Word选项】窗口,点击左侧菜单的【加载项】。3、点击【加载项】后,在弹出的窗口的下方【管理】中,选择【模板】。4、选择好【模板】后,点击右边的【转到】。5、在【共用模板及加载项】中可以看到【MathType Command 6 For Word 2010”前面的勾选框是选中的,讲勾选去掉,再点击右下方的【确定】。就解决了word快捷键粘贴不能用的问题

2021-03-03 11:21:53 3357 1

原创 将一个64位整数U64转变为4个16位整数U16(或U32转为4个U8)

今天需要将一个U64时间戳转化为4个U16,记录一下#include<stdio.h> #include<stdlib.h>#include<math.h>int main(){ unsigned long long int x = 978328074055923918; printf("before transform: %lld\n", x); unsigned long long int i, a[4]; printf("U16: \n"); f

2020-12-23 19:55:38 1872

转载 initializer element is not constant

转载为什么出现“initializer element is not constant”错误 看下面的代码: #include <stdio.h>int a = 1;int b = 2;int c = a+b; int main() { printf("c is %d\n", c); return 0;} gcc -o test test.c 编译时出现错误:initializer e

2020-12-20 22:04:52 554

转载 SyntaxError: Non-ASCII character ‘\xef‘ in file 错误解决

转载:SyntaxError: Non-ASCII character ‘\xef’ in file 错误解决 在测试SDIoT的python代码时,老是出现一个问题: 命令行里出现这个错误: SyntaxError: Non-ASCII character '\xef' in file  原因:Python的默认编码文件是用的ASCII码,你将文件存成了UTF-8也没用 解决办法:在文件开头

2020-11-21 16:21:29 4737

原创 度小满金融2020/9/20笔试

/*涂色时间限制: 1000MS内存限制: 65536KB题目描述:小A正在学画画,现在,线稿已经画好了,只剩下涂色部分了。但是小A发现,他的颜料不够了。每一块颜料能涂一个色块,每一个色块的颜色是事先决定好了的。 由于颜料不够,小A只能尽其所能来涂色。如果一个色块没有了颜料,就不能涂色。现在,给你画中需要的色块颜色,和小A现在手上有的颜料,请你计算小A能涂多少个色块。输入描述输入包含两个字符串,都仅包含大写字母,每一种字母代表一种颜色。 第一个字符串S代表小A手上的颜料,第二个字符串T代表

2020-09-20 21:42:48 453

原创 米哈游笔试9-19

1.顺时针旋转打印字符('A’到’Z’循环打印)#include <iostream>#include <vector>using namespace std;//AC:顺时针旋转打印字符('A'到'Z'循环打印)int main(){ int M, N; cin >> M >> N; vector<vector<char>> vc(M, vector<char>(N, 0)); char cur = '

2020-09-19 22:01:29 665

原创 岛屿问题DFS

695. 岛屿的最大面积200. 岛屿数量463. 岛屿的周长

2020-09-16 00:15:49 144

原创 剑指offer54二叉搜索树的第K大节点

剑指offer54二叉搜索树的第K大节点class Solution {public: int count = 0; TreeNode* KthNode(TreeNode* pRoot, int k) { if(pRoot == nullptr || k == 0) return nullptr; TreeNode* node = KthNode(pRoot->left, k); if(node != nullptr) ret

2020-09-14 16:57:44 74

原创 剑指offer53数字在升学数组中出现的次数(二分法)

剑指offer53数字在升学数组中出现的次数class Solution {public: int GetNumberOfK(vector<int> data ,int k) { if(data.size() == 0) return 0; int left = getFirstk(data, 0, data.size() - 1, k); int right = getLastk(data, 0, data.size() - 1, k

2020-09-14 15:56:37 2063

原创 剑指offer51数字中的逆序对(归并排序)

剑指offer51数字中的逆序对class Solution {public: int InversePairs(vector<int> data) { int len = data.size(); if(len == 0) return 0; vector<int> tmp(len); int ret = 0; mergeSort(data, tmp, 0, len - 1, ret);

2020-09-14 14:21:43 57

原创 欢聚yy笔试

//#include <bits/stdc++.h>#include <iostream>#include <string>using namespace std;//将字符型数字转换为32位整数class Solution {public: /** * 将字符串转换为整数输出 * @param str string字符串 输入字符串 * @return int整型 */ int str2Int(string str) { // wr

2020-08-31 21:28:20 119

原创 美团测开一面2020/8/26

手撕代码1、括号字符串的有效性限定语言:C、Python、C++、Javascript、Python 3、Java、Go给定一个字符串str,判断是不是整体有效的括号字符串(整体有效:即存在一种括号匹配方案,使每个括号字符均能找到对应的反向括号,且字符串中不包含非括号字符)。示例1输入“(())”输出true示例2输入“()a()”输出false说明()a()中包含了 ‘a’,a不是括号字符2、能否完美地拼成矩形能否完美地拼成矩形限定语言:C、Python、C++、Jav

2020-08-26 16:43:37 180

原创 华为机试-购物单

华为机试-购物单#include<iostream>#include<vector>using namespace std;int max(int m, int n){ return m>n?m:n;}int dp[3200];int main(){ int N,n,v,p,q; cin >> N >> n; N = N/10; int *ZJ_Pri = new int[n+1](); in

2020-08-23 09:39:27 155

原创 LeetCode402. 移掉K位数字(大疆2021/8/16后端B卷)

402. 移掉K位数字class Solution {public: string removeKdigits(string num, int k) { vector<int> s; string res = ""; for(int i = 0; i < num.size(); i++) { int number = num[i] - '0'; while(s.size() != 0

2020-08-16 22:40:15 175

原创 剑指 Offer 48. 最长不含重复字符的子字符串

剑指 Offer 48. 最长不含重复字符的子字符串class Solution {public: //哈希表 + 双指针 int lengthOfLongestSubstring(string s) { unordered_map<int, int> dic; int res = 0; for(int i = 0, j = 0; j < s.length(); j++) { dic[s[j]]++

2020-08-15 15:48:23 60

原创 剑指offer49丑数

丑数class Solution {public: int GetUglyNumber_Solution(int index) { if(index <= 0) return 0; int p2 = 0, p3 = 0, p5 = 0; //初始化三个指向三个潜在成为最小丑数的位置 vector<int> res(index, 0); res[0] = 1; for(int i = 1; i

2020-08-15 11:11:46 65

原创 剑指 Offer 47. 礼物的最大价值

剑指 Offer 47. 礼物的最大价值/*class Solution {public: //超时:时间O(m * n)(m, n分别为矩阵的第一维和第二维的长度),空间O(1) int res = 0; int maxValue(vector<vector<int>>& grid) { int len1 = grid.size(); if(len1 == 0) return 0; int len2

2020-08-14 15:55:12 53

转载 c++优先队列(priority_queue)用法详解

c++优先队列(priority_queue)用法详解

2020-08-13 22:29:51 89

原创 剑指offer顺时针打印矩阵

剑指offer顺时针打印矩阵class Solution {public: vector<int> printMatrix(vector<vector<int> > matrix) { vector<int> res; if(matrix.size() == 0 || matrix[0].size() == 0) return res; int top = 0; int bottom

2020-08-12 11:34:50 63

原创 剑指offer合并两个排序的链表(使用dummyHead)

合并两个排序的链表/*struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { }};*/class Solution {public: ListNode* Merge(ListNode* pHead1, ListNode* pHead2) { if(!pHead1) return pHead2; if(!pHead2

2020-08-12 01:29:49 100

原创 剑指 Offer 19. 正则表达式匹配

剑指 Offer 19. 正则表达式匹配class Solution {public: bool isMatch(string s, string p) { if(p.empty()) { return s.empty(); } //检查第一个元素是否匹配 bool first_match = !s.empty() && (s[0] == p[0] || p[0] == '.');

2020-08-06 19:03:43 85

原创 剑指 Offer 17. 打印从1到最大的n位数

剑指 Offer 17. 打印从1到最大的n位数class Solution{public: vector<int> res; vector<int> printNumbers(int n) { if (n <= 0) return res; string number(n, '0'); for (int i = 0; i <= 9; i++) //从高位到低位进行全排列 { number[0] = i + '0';//首字符赋初值

2020-08-03 16:59:43 81

原创 剑指 Offer 16. 数值的整数次方

剑指 Offer 16. 数值的整数次方/*class Solution {public: //超时 double myPow(double x, int n) { if(n == 0) return (double)1; int flag = n > 0 ? 1 : -1; unsigned int absN = n > 0 ? n : -n; double ans = helper(x, absN);

2020-08-03 15:31:28 60

原创 剑指 Offer 14- I. 剪绳子&&剑指 Offer 14- II. 剪绳子 II

剑指 Offer 14- I. 剪绳子class Solution {public: int cuttingRope(int n) { if(n == 2) return 1; if(n == 3) return 2; int ans = 0; int numOf3 = n / 3; int modulus = n % 3; if(modulus == 0) { ans = p

2020-08-02 20:33:16 54

原创 剑指 Offer 13. 机器人的运动范围

剑指 Offer 13. 机器人的运动范围class Solution { //BFSpublic: int count = 0; int movingCount(int m, int n, int k) { vector<vector<int>> flag(m, vector<int> (n, 0)); helper(m, n, k, 0, 0, flag); return count;

2020-07-31 20:40:48 54

原创 剑指 Offer 12. 矩阵中的路径

剑指 Offer 12. 矩阵中的路径class Solution {public: unsigned int len1, len2; bool exist(vector<vector<char>>& board, string word) { len1 = board.size(); if(len1 == 0) return false; len2 = board[0].size(); if

2020-07-31 19:16:42 66

原创 LeetCode79. 单词搜索

79. 单词搜索class Solution {public: unsigned int len1, len2; bool exist(vector<vector<char>>& board, string word) { len1 = board.size(); if(len1 == 0) return false; len2 = board[0].size(); vector<vec

2020-07-31 16:46:16 61

转载 VMware虚拟机 Linux系统 Ubuntu 16.04 硬盘/磁盘扩容(超详细图文详解!亲测有效!)

VMware虚拟机 Linux系统 Ubuntu 16.04 硬盘/磁盘扩容(超详细图文详解!亲测有效!)

2020-07-30 23:10:59 214

原创 剑指 Offer 11. 旋转数组的最小数字

剑指 Offer 11. 旋转数组的最小数字class Solution {public: int minArray(vector<int>& numbers) { int len = numbers.size(); if(len == 0) return INT_MAX; int left = 0; int right = len - 1; while(left < right) {

2020-07-30 22:42:39 53

转载 MobaXterm远程连接工具连接不上Linux解决办法:

MobaXterm远程连接工具连接不上Linux解决办法:

2020-07-30 15:18:31 2955

转载 Ubuntu输入ifconfig找不到IP地址,只有lo问题

Ubuntu输入ifconfig找不到IP地址,只有lo问题

2020-07-30 15:14:36 307

原创 剑指 Offer 10- II. 青蛙跳台阶问题

剑指 Offer 10- II. 青蛙跳台阶问题class Solution {public: //(a + b) % c = (a % c + b % c) % c; //时间O(n), 空间O(1) int numWays(int n) { if(n == 0) return 1; if(n <= 3) return n; int s1 = 1; int s2 = 2; int sum =

2020-07-29 23:57:07 68

空空如也

空空如也

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

TA关注的人

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