上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 32 下一页
摘要: 给定一个二叉树和所要查找的两个节点,找到两个节点的最近公共父亲节点(LCA)。比如,节点5和1的LCA是3,节点5和4的LCA是5。 class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, Tr 阅读全文
posted @ 2022-11-27 23:34 MarkLeeBYR 阅读(23) 评论(0) 推荐(0)
摘要: Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1,2] Output: false public boolean isPalindrome(ListNode head) { ListNode mid 阅读全文
posted @ 2022-11-27 16:59 MarkLeeBYR 阅读(22) 评论(0) 推荐(0)
摘要: 剑指offer 二叉搜索树的第k个节点 https://www.cnblogs.com/MarkLeeBYR/p/9773509.html 阅读全文
posted @ 2022-11-27 16:47 MarkLeeBYR 阅读(19) 评论(0) 推荐(0)
摘要: 剑指offer https://www.cnblogs.com/MarkLeeBYR/p/9776556.html 阅读全文
posted @ 2022-11-27 16:42 MarkLeeBYR 阅读(17) 评论(0) 推荐(0)
摘要: 参考剑指offer 最小的k个数字 https://www.cnblogs.com/MarkLeeBYR/p/9775091.html 阅读全文
posted @ 2022-11-24 14:42 MarkLeeBYR 阅读(14) 评论(0) 推荐(0)
摘要: Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. class TrieNode 阅读全文
posted @ 2022-11-24 10:58 MarkLeeBYR 阅读(20) 评论(0) 推荐(0)
摘要: 剑指offer 反转链表 https://www.cnblogs.com/MarkLeeBYR/p/9773053.html 阅读全文
posted @ 2022-11-24 10:41 MarkLeeBYR 阅读(12) 评论(0) 推荐(0)
摘要: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands. An island is surrounded by wa 阅读全文
posted @ 2022-11-24 10:19 MarkLeeBYR 阅读(20) 评论(0) 推荐(0)
摘要: Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bot 阅读全文
posted @ 2022-11-23 23:34 MarkLeeBYR 阅读(19) 评论(0) 推荐(0)
摘要: 给定一个整数数组Arr,求解数组中连续的不相邻元素的和的最大值。例如:对于数组中的元素A1,A2,A3,A4,则需要判断A1+A3,A1+A4,A2+A4中的最大值即为所求。 状态转移方程:dp[i] = max(dp[i - 2], dp[i - 3]) + num[i] 其中,dp[i]表示打劫 阅读全文
posted @ 2022-11-23 23:09 MarkLeeBYR 阅读(18) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 32 下一页