摘要:1 public static int maxDepth(TreeNode root) { if (root == null) { return 0; } // 递归计算左子树和右子树的深度 int leftDepth = maxDepth(root.left); int rightDepth =
阅读全文
摘要:1 class ListNode { int val; ListNode next; ListNode(int val) { this.val = val; this.next = null; } } public class SwapNodes { // 方法:交换相邻节点 public stat
阅读全文