摘要: 输入:nums1 = [1,2,3,0,0,0], m = 3nums2 = [2,5,6], n = 3 输出: [1,2,2,3,5,6] public void merge(int[] nums1, int m, int[] nums2, int n) { int i = m - 1; int 阅读全文
posted @ 2024-08-27 19:25 MarkLeeBYR 阅读(21) 评论(0) 推荐(0)
摘要: 二叉树中的路径被定义为一条节点序列,序列中每对相邻节点之间都存在一条边。同一个节点在一条路径序列中至多出现一次 。该路径 至少包含一个节点,且不一定经过根节点。 路径和是路径中各节点值的总和。 给你一个二叉树的根节点 root ,返回其 最大路径和 。 class Solution { int ma 阅读全文
posted @ 2024-02-04 15:19 MarkLeeBYR 阅读(26) 评论(0) 推荐(0)
摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文
posted @ 2024-01-19 23:56 MarkLeeBYR 阅读(22) 评论(0) 推荐(0)
摘要: public List<Integer> postorderTraversal(TreeNode root) { List<Integer> list = new ArrayList<>(); if (root == null) return list; Stack<TreeNode> stack 阅读全文
posted @ 2024-01-04 17:47 MarkLeeBYR 阅读(24) 评论(0) 推荐(0)
摘要: Solution 1://非递归 public List<Integer> preorderTraversal(TreeNode root) { List<Integer> result = new ArrayList<>(); if (root == null) { return result; 阅读全文
posted @ 2024-01-04 17:45 MarkLeeBYR 阅读(20) 评论(0) 推荐(0)
摘要: 输入321,需要输出123 public static int reverse(int x) { int res = 0; while (x != 0) { // 下一步要res*10,所以这一步要保证res*10不大于 Integer.MAX_VALUE if (Math.abs(res) > I 阅读全文
posted @ 2024-01-04 17:29 MarkLeeBYR 阅读(19) 评论(0) 推荐(0)
摘要: 和题目108类似:108是数组 https://www.cnblogs.com/MarkLeeBYR/p/16906818.html public TreeNode sortedListToBST(ListNode head) { if (head == null) { return null; } 阅读全文
posted @ 2024-01-04 16:25 MarkLeeBYR 阅读(18) 评论(0) 推荐(0)
摘要: Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2023-10-16 14:25 MarkLeeBYR 阅读(19) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce. For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2023-10-09 22:42 MarkLeeBYR 阅读(20) 评论(0) 推荐(0)
摘要: GC日志分析,不同版本jdk和垃圾收集器的日志格式相差很多,以G1收集器,jdk8举例,参考:https://blog.csdn.net/weixin_42340670/article/details/121743655 gc日志中大部分都是young gc日志,即使有混合gc,在混合gc周期中也至 阅读全文
posted @ 2023-09-06 14:18 MarkLeeBYR 阅读(251) 评论(0) 推荐(0)