算法
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 · 379 阅读 · 0 评论 -
LCA-二叉树公共祖先问题
二叉搜索树 leetcode 235. Lowest Common Ancestor of a Binary Search Tree class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if(root.val>p.val &am...原创 2019-07-30 16:56:57 · 213 阅读 · 0 评论 -
Leetcode之PathSum问题
Path Sum leetcode - 112. Path Sum class Solution { public boolean hasPathSum(TreeNode root, int sum) { if(root==null){ return false; } if(root.left==...原创 2019-08-01 18:24:25 · 301 阅读 · 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 · 358 阅读 · 0 评论
分享