自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 xxljob偶然任务调度失败(无调度记录)-原因分析

xxljob调度失败

2022-02-18 10:08:56 3268 4

原创 window+linux+nacos集群(2)

4 启动多个nacos服务器之前启动的方式都是使用 standalone也就是单机模式,虽然实现了windos和linux下的nacos使用同一个数据库的目的,但是其本质还是单机模式。只是实现了使用同一个数据库达到数据统一的功能而已。4.1 在Windos下搭建一个nacos集群我的nacos版本是1.4.2,在我这个版本里,nacos/conf文件夹下,是不存在cluster.conf这一个一个配置文件的,而集群模式必须要这么一个文件,否则就无法使用cluster模式启动Windos下的nacos。

2021-05-07 22:57:01 256

原创 window+linux+nacos集群(1)

前言:在Windos和Linux的Docker中搭建nacos集群只是出于学习的目的,生产环境中请不要这么使用nacosNacos集群在Linux服务器上启动一个Nacos,然后在Windos本地启动一个Nacos,如何去保证他们使用数据的一致性?第一个问题,Nacos本身的数据是存在哪里的?上面配置的配置文件,肯定不是存在内存里,因为重启Nacos之后任然可以查到这些数据。因为这些数据是存在一个嵌入式的数据库,这样一来,如果启动了多个Nacos,这个数据库是不共享的,就会出现数据的不一致性问题。解

2021-05-06 21:31:49 242 1

原创 每日一题算法:国庆算法补课

10月1日 秋叶收藏集class Solution { public int minimumOperations(String leaves) { }}解题思路:这道题中的最少调整次数是如何得到的?我认为这道题的核心就在于这一点,那么如何得到这个最少调整次数呢?我想了很久也只能想到一个非常不可靠的暴力破解的方法。所以选择去看答案学习如何实现。动态规划学习:动态规划之前总是觉得自己会用,但是实际写又写不出,所以趁着这道题的机会好好学习学习什么叫动态规划,以及动态规划的题该怎么

2020-10-09 11:25:07 244

原创 每日一题算法:2020年9月30日 [二叉搜索树中的插入操作] insertIntoBST

2020年9月30日 二叉搜索树中的插入操作 insertIntoBST/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { this.val = val; } * TreeNode(int va

2020-09-30 09:53:36 195

原创 每日一题算法:2020年9月29日 [二叉树的后序遍历] postorderTraversal

2020年9月29日 二叉树的后序遍历 postorderTraversal/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { this.val = val; } * TreeNode(int

2020-09-29 09:31:07 211

原创 每日一题算法:2020年9月28日 [填充每个节点的下一个右侧节点指针 II]connect

2020年9月28日 填充每个节点的下一个右侧节点指针 II connect/*// Definition for a Node.class Node { public int val; public Node left; public Node right; public Node next; public Node() {} public Node(int _val) { val = _val; } p

2020-09-28 09:38:52 136

原创 每日一题算法:2020年9月27日 [ 二叉搜索树的最近公共祖先]lowestCommonAncestor

2020年9月27日 二叉搜索树的最近公共祖先lowestCommonAncestor/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { TreeNode res=

2020-09-27 15:18:24 111

原创 每日一题算法:2020年9月26日 [路径总和 II] pathSum

2020年9月26日 路径总和 IIpathSum/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<List<Integer&gt

2020-09-26 23:25:34 80

原创 每日一题算法:2020年9月25日 [从中序与后序遍历序列构造二叉树]buildTree

2020年9月25日 从中序与后序遍历序列构造二叉树 buildTree/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode buildT

2020-09-25 10:22:10 217

原创 每日一题算法:2020年9月24日 [二叉搜索树中的众数] findMode

2020年9月24日 二叉搜索树中的众数 findMode/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public int[] findMode(TreeNod

2020-09-24 23:29:42 216

原创 每日一题算法:2020年9月23日 [合并二叉树] mergeTrees

2020年9月23日 合并二叉树 mergeTrees/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode mergeTrees(Tree

2020-09-23 08:53:45 299

原创 每日一题算法:2020年9月22日[监控二叉树] minCameraCover

2020年9月22日 监控二叉树 minCameraCover/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public int minCameraCover(T

2020-09-22 11:38:51 150

原创 每日一题算法:2020年9月21日 [把二叉搜索树转换为累加树] convertBST

2020年9月21日 把二叉搜索树转换为累加树 convertBST/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode convertB

2020-09-21 09:03:13 105

原创 每日一题算法:2020年9月20日 [子集] subsets

2020年9月20日 子集subsetsclass Solution { public List<List<Integer>> subsets(int[] nums) { }}解题思路:还是前面几天的老办法,递归。[1,2,3]能够组成的所有组合等于[2,3]能够组成的所有组合+[1]+1和[2,3]能够组成的所有组合的组合。代码实现:class Solution { public List<List<Integer>

2020-09-20 22:36:37 87

原创 每日一题算法:2020年9月19日 [左叶子之和] sumOfLeftLeaves

2020年9月19日 左叶子之和 sumOfLeftLeaves/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public int sumOfLeftLeave

2020-09-19 16:47:46 164

原创 每日一题算法:2020年9月18日 [全排列 II](https://leetcode-cn.com/problems/permutations-ii/) permuteUnique

2020年9月18日 全排列 II permuteUniqueclass Solution { public List<List<Integer>> permuteUnique(int[] nums) { }}解题思路:这道题我的思路是选择递归算法,我们求[1,1,2]组成的所有组合,可以把它降级成为求以1开头,[1,2]组成的所有组合。然后我们循环完这个数组,把递归得到的结果也就是[1,2]能够组成的所有组合前面再加上当前正在循环的数字。就得到了以1

2020-09-18 09:48:23 209

原创 每日一题算法:2020年9月17日 [冗余连接 II] findRedundantDirectedConnection

2020年9月17日 冗余连接 IIfindRedundantDirectedConnectionclass Solution { public int[] findRedundantDirectedConnection(int[][] edges) { }}解题思路:先说一说看完之后对题目的理解。有根树:在有向图中找到一个没有父节点的节点,并且其他节点都只有一个父节点。这道题的第一步,我们要知道哪一个节点是根节点,这个实际上可能不存在,因为题中规定,删除一条边就能够使有向

2020-09-17 22:57:27 210

原创 每日一题算法:2020年9月16日 [翻转二叉树] invertTree

2020年9月16日 翻转二叉树 invertTree/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode invertTree(Tree

2020-09-16 08:47:41 191

原创 每日一题算法:2020年9月15日 [解数独] solveSudoku

2020年9月15日 解数独solveSudokuclass Solution { public void solveSudoku(char[][] board) { }}解题思路:数独是我曾经非常喜欢玩的一款游戏,以前在步步高学习机上没有什么可以玩的游戏,所以对数独也算是有一些研究吧。首先数独是只能有唯一解的,这道题就做得很好,他说明了数独只有唯一的解,因为之前做数独能够存在多解,那时候我解数独的方式比较类似于算法中的递归+回溯,当一个位置能填的数字存在多种可能时,我会先

2020-09-15 14:35:02 730

原创 每日一题算法:2020年9月14日 [二叉树的中序遍历] inorderTraversal

2020年9月14日 二叉树的中序遍历inorderTraversal/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<Integer&

2020-09-14 09:30:49 180

原创 每日一题算法:2020年9月13日 [单词搜索](https://leetcode-cn.com/problems/word-search/) exist

2020年9月13日 单词搜索 existclass Solution { public boolean exist(char[][] board, String word) { }}解题思路:首先遍历数组,找到一个对应的起始节点,也就是和word的首字母相同的坐标位置。然后以这个位置作为起点,对其进行递归处理,这个递归的函数另外写一个,然后返回该点的递归结果。递归的规则:当前点是否是字符串的index坐标的字符时,判断index是否是字符串的长度,如果不是,那就判断周围

2020-09-13 19:55:21 157

原创 每日一题算法:2020年9月12日[二叉树的层平均值] averageOfLevels

2020年9月12日二叉树的层平均值 averageOfLevels[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EI7Gm6G0-1599919552885)(C:%5CUsers%5CAdmin%5CAppData%5CRoaming%5CTypora%5Ctypora-user-images%5Cimage-20200912213744908.png)]/** * Definition for a binary tree node. * public class

2020-09-12 22:06:39 117

原创 每日一题算法:2020年9月11日 [组合总和 III] combinationSum3

2020年9月11日 组合总和 IIIcombinationSum3class Solution { public List<List<Integer>> combinationSum3(int k, int n) { }}解题思路:今天这道题相比之前的两道题,他特点在于限制了长度,也就是说他必须是规定长度的组合,不允许多也不允许少,这一点该如何实现呢?我的想法是,还是递归啊,每次递归一层就把这个长度-1,当长度为1的时候就要求数字必须为0,否则返回空

2020-09-11 09:31:30 136

原创 每日一题算法 : 2020年9月10日[组合总和 II] combinationSum2

2020年9月10日组合总和 II combinationSum2class Solution { public List<List<Integer>> combinationSum2(int[] candidates, int target) { }}解题思路:今天这道题和昨天那道非常类似,区别在于今天这个是不允许重复,但是不允许重复的话这道题会更加简单一些,因为这就变成了单纯的递归+回溯的算法了。还是昨天的思路,递归的三大关键:1,流程逻辑怎么

2020-09-11 08:24:46 197

原创 每日一题算法:2020年9月9日 [ 组合总和] combinationSum

2020年9月9日 组合总和 combinationSumclass Solution { public List<List<Integer>> combinationSum(int[] candidates, int target) { }}解题思路:这道题的算法用的是递归算法,主要的递归流程是这样的。经过归纳总结,递归一般来说分成这3部分的核心部分。1:大问题->小问题->小小问题->…一个问题可以先解决其中的一小部分问题然

2020-09-09 10:17:19 177

原创 每日一题算法:2020年9月8日 [ 组合](https://leetcode-cn.com/problems/combinations/) combine

2020年9月8日 组合 combineclass Solution { public List<List<Integer>> combine(int n, int k) { }}解题思路:只要对题目进行一些基本的分析,不难发现这其实是一道递归的题目。而且是一道双递归的题目。首先我们要理清这道题的本质。我们可以这么想,所有的组合可能种,除去包含1的组合还有多少?怎么求?我们可以这么表示不包含1的组合,2-n能够组成的长度为2的组合。那么根据这个规则

2020-09-08 11:18:41 181

原创 每日一题算法:前 K 个高频元素](https://leetcode-cn.com/problems/top-k-frequent-elements/) topKFrequent

2020年9月7日 前 K 个高频元素 topKFrequentclass Solution { public int[] topKFrequent(int[] nums, int k) { }}解题思路:思路1:简单解决这道题如果只是单纯地想要得到结果,算法非常简单。首先使用一个Map的键来存不同的元素数字,用他的值作为元素的个数。实现流程:从数组中取出所有元素,取出每一个元素时在Map中将其的值+1,直到取完数组的每一个元素。然后将map中的键与值取

2020-09-07 23:23:40 178

原创 每日一题算法:2020年9月6日 [二叉树的层次遍历 II] levelOrderBottom

2020年9月6日 二叉树的层次遍历 II levelOrderBottom/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<List&

2020-09-06 22:15:26 106

原创 每日一题算法:2020年9月5日[ 第k个排列] getPermutation

2020年9月5日 第k个排列getPermutationclass Solution { public String getPermutation(int n, int k) { }}解题思路:思路1,暴力算法直接使用循环将每一种情况按照顺序列出,然后取出第k个元素,时间复杂度nXn!,这肯定不是一个好的方法,所以需要寻找一种更优秀的方法。思路2,递归其实我们可以非常简单地知道,第k个数的第1个数字是多少,比如:n=5 k=54,由于n=5,我们可以知道共有5!种排列

2020-09-05 09:37:54 176

原创 每日一题算法:2020年9月4日 [二叉树的所有路径] binaryTreePaths

2020年9月4日 二叉树的所有路径 binaryTreePaths/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<String&gt

2020-09-04 09:10:26 129

原创 每日一题算法:2020年9月3日 [N 皇后] solveNQueens

2020年9月3日 N 皇后 solveNQueensclass Solution { public List<List<String>> solveNQueens(int n) { }}解题思路:思路1,暴力递归。我们遍历棋盘的每一种组合形式,从而暴力得出所有可能的情况。首先第一列,同一列中不会出现两个Q,所以,我们第一列存在n中情况,我们在每一种情况中都将所有不能再放Q的位置上使用“.”来填充,没被限制的还是使用默认的0x

2020-09-03 11:11:18 151

原创 每日一题算法:2020年9月2日[表示数值的字符串] isNumber

2020年9月2日表示数值的字符串 isNumberclass Solution { public boolean isNumber(String s) { }}解题思路:首先,这道题必定会有很多的坑,从这20%的提交成功率上就能看出来,遇到坑没法避免的时候最好的办法就是踩一遍所有坑,踩完就可以顺利通过了。所以现在我只是针对所有例题中的情况作出通配的计算,其他类型的暂且不管。进过分析,第一次尝试时将这个字符串表示为(正负号)数字(小数点)数字(E/e)(正负号)(数字)

2020-09-02 11:24:42 147

原创 每日一题算法:2020年9月1日 [预测赢家] PredictTheWinner

2020年9月1日 预测赢家 PredictTheWinnerclass Solution { public boolean PredictTheWinner(int[] nums) { }}解题思路:一般来说,这种游戏规则类题目考验的是你的逻辑能力,看你能否察觉到游戏的本质是什么,其实有很多的这种小游戏能够看穿本质之后就会变得很无聊。思路1,使用递归。我们的问题是,玩家1能否获胜。那么我们可以试着改变思路,把问题变成,当玩家1选择的第1个或者玩家1选择了最后一个之后,玩

2020-09-01 10:21:11 235

原创 每日一题算法:2020年8月31日 [钥匙和房间] canVisitAllRooms

2020年8月31日 钥匙和房间 canVisitAllRoomsclass Solution { public boolean canVisitAllRooms(List<List<Integer>> rooms) { }}解题思路:这道题不难看出,应该是使用图的思想,那就是需要用到图的搜索算法。可以选择广度优先算法,一个房间搜索完后,前往所有钥匙能够通往的房间拿那个房间内的钥匙,然后拿着这些钥匙前往这些钥匙能够进入的房间,再次取出所有的钥匙。这就是非

2020-08-31 08:49:25 165

原创 每日一题算法:2020年8月30日 [反转字符串中的单词 III] reverseWords

2020年8月30日 反转字符串中的单词 III reverseWordsclass Solution { public String reverseWords(String s) { }}解题思路:这道题没啥难度,就是简单的循环就能解决的问题,只需要稍微加一些逻辑的判断,还是挺简单的。没啥特殊的算法就不写什么思想了。 public String reverseWords(String s) { int len=s.length();

2020-08-30 21:53:26 189

原创 每日一题算法:2020年8月29日 [最短回文串](https://leetcode-cn.com/problems/shortest-palindrome/) shortestPalindrome

2020年8月29日 最短回文串 shortestPalindromeclass Solution { public String shortestPalindrome(String s) { }}解题思路:我的想法是这样子的,如果一个在一个字符串前面加上几个字符就能组成一个回文串,那么加上的这几个必定是该字符串末尾的几个字符的倒置。那么我们可以把一个字符串拆分成下面这样三个部分。假设我们有一个字符串,abaca,那么要在前面添加字符让他成为一个回文,这个字符可以拆分为中间的

2020-08-29 22:10:55 154

原创 每日一题算法:2020年8月28日 [机器人能否返回原点] judgeCircle

2020年8月28日 机器人能否返回原点 judgeCircleclass Solution { public boolean judgeCircle(String moves) { }}解题思路:这。这道题有些简单,我们只需要记录下机器人的坐标,假设机器人的初始左边是(0,0),当他R的时候,横坐标+1也就是x+1,当他L的时候,横坐标-1,也就是x-1。最后,我们读取完他走过的所有路程后,判断他是否在原点就可以了。 public boolean judgeCir

2020-08-28 14:37:37 114

原创 每日一题算法:2020年8月27日 [重新安排行程] findItinerary

2020年8月27日 重新安排行程 findItineraryclass Solution { public List<String> findItinerary(List<List<String>> tickets) { }}解题思路:首先这个自然排序,实际上有一个非常简单的方法我学到过,就是直接使用hashcode,比如下面三个字符串的hashcode就可以直接看出排序。知道这一点之后就是使用搜索算法了,使用有选择性的搜索算法,既不

2020-08-27 23:32:57 140

原创 每日一题算法:2020年8月26日 [电话号码的字母组合] letterCombinations

2020年8月26日 电话号码的字母组合 letterCombinationsclass Solution { public List<String> letterCombinations(String digits) { }}解题思路:这道题貌似没有什么技巧可言,可以使用穷举的方式列举出所有可能的情况一共就8种,将原来的字符串复制并且加上新的字母,这道题可能考察的是不同字符串操作的效率吧。代码实现:看起来这道题有一些巧妙的解决方案,

2020-08-26 16:58:06 204

空空如也

空空如也

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

TA关注的人

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