![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
junzhiL
我不生产知识,我只是知识的搬运工...
展开
-
链表反转总结
链表反转单链表反转leetcode 206 reverse-linked-list递归解法class Solution { public ListNode reverseList(ListNode head) { if(head==null || head.next==null){ return head; } ...原创 2019-07-03 00:03:54 · 322 阅读 · 0 评论 -
LCA-二叉树公共祖先问题
二叉搜索树leetcode 235. Lowest Common Ancestor of a Binary Search Treeclass Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root.val>p.val &am...原创 2019-07-30 16:56:57 · 160 阅读 · 0 评论 -
Leetcode之PathSum问题
Path Sumleetcode - 112. Path Sumclass Solution { public boolean hasPathSum(TreeNode root, int sum) { if(root==null){ return false; } if(root.left==...原创 2019-08-01 18:24:25 · 177 阅读 · 0 评论 -
LeetCode-347 出现频率最多的 k 个数
leetcode-347. Top K Frequent Elements本文答案参考自leetcode评论区解法一:桶排序时间复杂度O(n)class Solution { public List<Integer> topKFrequent(int[] nums, int k) { Map<Integer,Integer> map = ...原创 2019-08-08 15:39:07 · 285 阅读 · 0 评论