自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

侠客小虎的博客

一直奔跑的小蜗牛

  • 博客(359)
  • 收藏
  • 关注

原创 Lubuladong算法小抄思考和题集

0.引言本文主要针对Labuladong算法小抄中设计的LeetCode提集进行整理,并给出相关题目解法。小编欢迎大佬指出其中问题,可随时通过邮件联系小编:xiakexiaohu#163.com。1.算法核心关键点TODO2.题集及解法1.两数之和3.无重复字符的最长子串5.最长回文子串10.正则表达式匹配15.三数之和18.四数之和20.有效的括号22.括号生成25.K 个一组翻转链表26.删除排序数组中的重复项34.在排序数组中查找元素的第一个和最后一个位置37

2023-05-14 19:36:23 575 1

原创 Spring事务传播行为Propagation及原理

Spring事务传播行为Propagation及原理

2022-10-13 23:46:53 561

原创 LeetCode.763 Partition Labels(标签分类)

LeetCode 标签分割

2022-06-07 11:46:28 242

原创 全组合(SubSets)全排列(Permutation)全组合和(Combination Sum)解题技巧

1.1 全组合(无重复)题目:给定一个数组(不存在重复),输出所有可能的组合,不限定顺序(LeetCode 78)。样例:[1,2,3]=>[[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]技巧:因为是不存在重复的,典型的采用递归即可,即每次取定第一个开始的节点,然后从该节点后面开始放数据和出数据代码:class Solution { public List<List<Integer>> subsets(int[] num

2021-08-15 22:36:18 1782 1

原创 LeetCode.1861 Rotating the Box(旋转箱子)

1.题目You are given an m x n matrix of characters box representing a side-view of a box. Each cell of the box is one of the following:A stone ‘#’A stationary obstacle ‘*’Empty ‘.’The box is rotated 90 degrees clockwise, causing some of the stones to fal

2021-08-01 23:19:14 295 1

原创 LeetCode.791 Custom Sort String(自定义字符串排序)

1.题目You are given two strings order and s. All the words oforderareuniqueand were sorted in some custom order previously.Permute the characters ofsso that they match the order thatorderwas sorted. More specifically, if a characterxoccurs befo...

2021-07-24 22:26:39 174

原创 LeetCode.713 Subarray Product Less Than K(连续子数组乘积比k小的个数)

1.题目Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k. Example 1:Input: nums = [10,5,2,6], k = 100Output: 8Explanation: The 8

2021-07-20 12:58:11 168

原创 《MySQL实战45讲》学习笔记

1.Mysql查询一条sql的执行过程:[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-E1Joan21-1621222288670)(http://note.youdao.com/yws/res/26751/662F638BA3FF46E98367F153859120DE)]首先连接器负责连接到指定的数据库上,接着看看查询缓存中是否有这条语句,如果有就直接返回结果。如果缓存没有命中的话,就需要分析器来对SQL语句进行语法和词法分析,判断SQL语句是否合法。现在来到优

2021-05-17 11:31:48 545 1

原创 Java方法耗时诊断-Arthas

1.背景某个业务方调用自己工程的rpc,由于本工程内的rpc耗时过长,导致调用rpc熔断(invoke rpc timeout)。2.问题排查2.1 事先准备确保线上和预发环境代码一致相关机器安装了Arthas,该诊断操作不建议在生产环境使用,可离线排查相关耗时。2.2 耗时分析1.启动Arthas$java -jar arthas-boot.jar2.选定指定PID选定相关java进程的PID前面的行号,输入回车即3.指定相关耗时方法Arthas可使用Tr

2021-05-15 22:16:32 871

原创 记一次 OOM:GC overhead limit exceeded排查

1.背景产品大大对程序员小亮抱怨某个计算收益类型的任务每次都要2+小时才能跑完,希望该任务能快速优化下。小亮嘴上嘟嚷道:可以做,要先提需求单(内心写照如下图)。2.分析2.1 流程1.程序员小亮对着收益类型的任务一顿分析,心想这还不简单(单线程改成多线程不就完事了)。遇事不要慌,开局先来一副流程图:2.2 TTL多线程- 多线程使用这还不简单,直接ThreadPoolExecutor走起,但是想到组内建议使用阿里的ThreadLocal Transmittable ThreadLoc

2021-04-28 20:23:31 1987 3

原创 LeetCode.491 Increasing Subsequences(递增子序列)

1.题目Given an integer array nums, return all the different possible increasing subsequences of the given array with at least two elements. You may return the answer in any order.The given array may contain duplicates, and two equal integers should also b

2021-04-13 23:21:59 114

原创 LeetCode.498 Diagonal Traverse(遍历矩阵)

1.题目Given a matrix of M x N elements (M rows, N columns), return all elements of the matrix in diagonal order as shown in the below image.Example:Input:[[ 1, 2, 3 ],[ 4, 5, 6 ],[ 7, 8, 9 ]]Output: [1,2,4,7,5,3,6,8,9]Explanation:Note:The tot

2021-01-04 00:20:14 146

原创 LeetCode.452 Minimum Number of Arrows to Burst Balloons(最少的箭射泡泡)

1.题目There are some spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it's horizontal, y-coordinates don't matter, and hence the x-coordinates of start an

2020-12-31 15:56:26 119

原创 LeetCode.386 Lexicographical Numbers(字典序输出连续数)

1.题目Given an integer n, return 1 - n in lexicographical order.For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].Please optimize your algorithm to use less time and space. The input size may be as large as 5,000,000.2.解答class Solution {

2020-12-10 23:40:42 115

原创 LeetCode.357 Count Numbers with Unique Digits (统计数字不同的总数)

1.题目Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.2. 样例Example:Input: 2Output: 91 Explanation: The answer should be the total numbers in the range of 0 ≤ x < 100, excluding 11,22,33,4

2020-11-07 13:51:23 144

原创 别再手动赋值对象了,MapStruct了解一下!!!

引言你是否已经对手动get/set感到厌烦、恶心。什么???你就喜欢写这种代码,那这篇文章不适合你。1.概述1.日常业务开发中我们经常会遇到以下几种对象:PO(persistant object): 持久化对象,可以看成是与数据库中的表相映射的 java 对象。最简单的 PO 就是对应数据库中某个表中的一条记录。VO(view object): 视图对象,用于展示层,它的作用是把某个指定页面(或组件)的所有数据封装起来。DTO(Data transport object):数据传输对象,

2020-10-23 13:06:40 1909

原创 LeetCode.399 Evaluate Division(评估除法)

1.题目You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable.You are also g

2020-10-10 23:43:06 139

原创 LeetCode.725 Split Linked List in Parts (将链表分成k段)

1.题目Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list “parts”.The length of each part should be as equal as possible: no two parts should have a size differing by more than 1. This

2020-09-12 12:59:27 156

原创 Leetcode.665 Non-decreasing Array(替换一个数成为非降序数组)

1.题目Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2

2020-08-09 21:00:50 241

原创 LeetCode.698 Partition to K Equal Sum Subsets(均分成k组和相等)

1.题目Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equal.2.输入/输出样例Input: nums = [4, 3, 2, 3, 5, 2, 1], k = 4Output: TrueExplanation: It's possible

2020-08-08 09:44:39 151

原创 LeetCode.540 01 Matrix(距离0最近的距离)

1.题目Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.2.输入输出样例子Example 1:Input:[[0,0,0], [0,1,0], [0,0,0]]Output:[[0,0,0], [0,1,0], [0,0,0]]Example 2:Input:[[0

2020-07-26 11:28:23 262

原创 LeetCode.738 Monotone Increasing Digits(单调递增的数)

1.题目Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits.(Recall that an integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.)2.样

2020-06-27 15:56:21 147

原创 LeetCode.658 Find K Closest Elements(查找最近的k个数)

1.题目Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a tie, the smaller elements are alway...

2020-05-04 15:44:12 300

原创 LeetCode.678 Valid Parenthesis String

题目Given a string containing only three types of characters: ‘(’, ‘)’ and ‘*’, write a function to check whether this string is valid. We define the validity of a string by these rules:Any left paren...

2020-04-22 00:30:27 247

原创 关于Maven你必须知道的知识点!!!

文章目录0.0.<Maven实战>相关Maven实战电子书地址请自行百度。1.关于Maven相关基础知识Maven基本坐标标签含义:定义项目属于哪个组,这个组往往和项目所在的组织和公式有关。必填项:定义当前Maven项目的唯一ID。必填项:指定当前开发项目的版本,(1.0.0-SNAPSHOT)SNAPSHOT意为快照,说明项目还在开发中。当项目稳定后即为relas...

2020-04-06 17:23:51 228

原创 LeetCode.539 Minimum Time Difference(求时间最小间隔)

题目Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.Example 1:Input: ["23:59","00:00"]Output: 1Note:...

2020-03-07 17:07:00 689

原创 LeetCode.303/304 Range Sum Query(2) - Immutable

303.题目(求数组子序列元素之和)Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRange(2...

2020-01-30 21:26:23 153

原创 LeetCode.221 Maximal Square(最大正方形面积)

题目Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.Example:Input: 1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Output: 4分析 class S...

2020-01-27 21:16:52 183

原创 JDK8-Optional类避免NPE

1.需求分析调用RPC返回结果、包装类转简单类型,拆箱过程最容易出现NPE问题。JDK8之前需要小心翼翼对各种类型进行判空,可通过JKD8-Optional类来预发未知的NPE错误。2.关于避免NPE的常识【强制】所有POJO类属性必须使用包装数据类型【强制】所有RPC方法的返回和参数必须使用包装数据类型【推荐】所有局部变量使用基本简单数据类型Ps:POJO类属性没有初值是提醒...

2019-06-28 16:00:24 6539

原创 ForkJoinPool线程池

在Java 7中引入了一种新的线程池:ForkJoinPool。它同ThreadPoolExecutor一样,也实现了Executor和ExecutorService接口。它使用了一个无限队列来保存需要执行的任务,而线程的数量则是通过构造函数传入,如果没有向构造函数中传入希望的线程数量,那么当前计算机可用的CPU数量会被设置为线程数量作为默认值。ForkJoinPool主要用来使用分治法(...

2019-01-24 10:00:36 7450 3

原创 JDK8新特性并行流-ParallelStream

package chap07.ParalleDemo;import java.util.function.Function;import java.util.stream.LongStream;import java.util.stream.Stream;class Accumlator{ public long total = 0; public void add...

2019-01-23 16:56:46 2424

转载 【转】IDEA中Maven报错NoClassDefFoundError

这是我走的大概三天的坑,一直搞不清楚原因,今天总算把问题解决了。 首先说问题的源头,是我使用SSM框架写j2ee程序,要使用到AOP,于是就在网上查找了如何使用maven添加AOP相关的jar包,之后配置了pom.xml文件如下:&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.or...

2019-01-18 16:32:00 1803 2

原创 SpringMVC整合MongDB

小编由于Maven项目需要将MongDB整合至SpringMVC项目中,希望能给同样需要的童鞋帮助。1.导入Pom.xml&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/...

2019-01-10 20:40:52 254

原创 Java8特性03-关于Stream中Map和FlatMap必知点

package chap03;import java.util.ArrayList;import java.util.Arrays;import java.util.List;import java.util.stream.Collectors;public class FlatMap { public static void main(String[] args) {...

2019-01-10 20:28:41 2417 1

转载 JDK8 新特性-Map对key和value分别排序实现

在Java 8 中使用Stream 例子对一个 Map 进行按照keys或者values排序.1. 快速入门  在java 8中按照此步骤对map进行排序.将 Map 转换为 Stream 对其进行排序 Collect and return a new LinkedHashMap (保持顺序)Map result = map.entrySet().stream() .sort...

2018-12-21 21:17:55 13890

原创 LeetCode.811 Subdomain Visit Count

题目:A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode...

2018-10-11 20:32:55 349

原创 LeetCode.423 Reconstruct Original Digits from English (字符串找规律匹配)

题目:Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order.Note:Input contains only lowercase English letters.Input is guaranteed...

2018-07-15 16:15:41 227

原创 LeetCode 85.Maximal Rectangle (DP-专题)

题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.Example:Input:[ ["1","0","1","0","0"], ["1","0","1"

2018-07-15 11:57:17 408

转载 GORM批量更新删除

Gorm 操作指导Create recordUpdate Record更新一条记录中的多个值更新多条记录Delete Record单条删除批量删除在使用 gorm 时,存在一些坑,这些坑如果不注意就极易影响到整个数据库的数据,故以此文作为记录来作为使用的指导。Create recordgorm 新建数据的方法有 Create()方法,但不能实现部分插入。它采用整体插入,struct 中声明变量都会...

2018-07-11 15:03:53 28749

转载 golang orm框架gorm使用

转载自:https://blog.csdn.net/hatlonely/article/details/79291198gorm 用法介绍库安装go get -u github.com/jinzhu/gorm1数据库连接import ( "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql")var...

2018-07-11 15:02:24 9676 1

空空如也

空空如也

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

TA关注的人

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