04 2022 档案
摘要:1005. K 次取反后最大化的数组和 class Solution { public int largestSumAfterKNegations(int[] nums, int k) { Arrays.sort(nums); int res = 0; //反转负数 计算总和 int i = 0,
阅读全文
摘要:53. 最大子数组和 class Solution { public int maxSubArray(int[] nums) { int count = 0, res = Integer.MIN_VALUE; int len = nums.length; for (int i = 0; i < le
阅读全文
摘要:37. 解数独 class Solution { public void solveSudoku(char[][] board) { backtracking(board); } private boolean backtracking(char[][] board) { //遍历整个数组找空位置填
阅读全文
摘要:51. N 皇后 class Solution { private List<List<String>> res; //存第i行放置位置 private int[] place; public List<List<String>> solveNQueens(int n) { res = new Ar
阅读全文
摘要:RocketMQ除了要开放9876和10911端口外,还需要开放10909和10912端口。原文链接:https://blog.csdn.net/m0_43404934/article/details/110281701
阅读全文
摘要:第一步:首先来到rocketmq目录下,修改conf文件夹下broker.conf 文件当中的配置 来到配置文件后在文件最后加上如下配置: #这里的ip地址修改成自己服务器的ip地址 brokerIP1=101.200.xxx.xxx autoCreateTopicEnable=true 第二步:如
阅读全文
摘要:作为Java开发人员,在Linux下安装一些开发工具是必备技能,本文以安装jdk为例,详细记录了每一步的操作命令,以供参考。 第一种方法 只需要一条命令就可以安装jdk: yum install java-1.8.0-openjdk* -y 执行了这条命令不需要配置,直接可以用 第二种方法 0.下载
阅读全文
摘要:46. 全排列 class Solution { private List<List<Integer>> res; private LinkedList<Integer> path; public List<List<Integer>> permute(int[] nums) { res = new
阅读全文
摘要:93. 复原 IP 地址 class Solution { private List<String> res; private Deque<StringBuilder> deque; public List<String> restoreIpAddresses(String s) { res = n
阅读全文
摘要:40. 组合总和 II class Solution { private List<List<Integer>> res; private LinkedList<Integer> path; private int sum; public List<List<Integer>> combinatio
阅读全文
摘要:39. 组合总和 class Solution { List<List<Integer>> res; LinkedList<Integer> path; int sum; public List<List<Integer>> combinationSum(int[] candidates, int
阅读全文
摘要:77. 组合 class Solution { List<List<Integer>> res; LinkedList<Integer> path; public List<List<Integer>> combine(int n, int k) { res = new ArrayList<>();
阅读全文
摘要:linux下启动rocketMQ 怕后边忘记 做下记录 首先第一步需要将rocketMQ项目上传到linux服务器上rocketmq-all-4.3.0-bin-release.zip //解压文件夹 unzip rocketmq-all-4.3.0-bin-release.zip 然后修改name
阅读全文
摘要:这里我是用window10下powershell连接的远程服务器 ssh root@服务器ip地址 连接数据库 mysql -u root -p 查看数据库 show database 创建自己的数据库,这里我创建的newsdb 使用该数据库 use newsdb 执行转储的sql文件 source
阅读全文
摘要:108. 将有序数组转换为二叉搜索树 递归 class Solution { public TreeNode sortedArrayToBST(int[] nums) { return build(nums, 0, nums.length - 1); } private TreeNode build
阅读全文
摘要:701. 二叉搜索树中的插入操作 //递归遍历搜索树 class Solution { public TreeNode insertIntoBST(TreeNode root, int val) { if (root == null) return new TreeNode(val); if (va
阅读全文
摘要:236. 二叉树的最近公共祖先 /* * 后序递归 反返回值为空则未找到 * 如果一个子树根节点就是目标值之一且另一个目标值也存在于该子树中 直接返回该子树根节点即可 * 因为我们会遍历整个树 且无重复树结点 如若另一个目标值不在该子树中 即会在高度更多的子树中找到并返回符合逻辑祖先节点 */ cl
阅读全文
摘要:98. 验证二叉搜索树 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNod
阅读全文
摘要:617. 合并二叉树 class Solution { public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { return prevOrder(root1, root2); } private TreeNode prevOrder(
阅读全文
摘要:105. 从前序与中序遍历序列构造二叉树 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {}
阅读全文
摘要:513. 找树左下角的值 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNo
阅读全文
摘要:110. 平衡二叉树 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode
阅读全文