摘要:
先走k-1步,然后判断fast有没有到空为止. 阅读全文
摘要:
题目链接: https://leetcode-cn.com/problems/top-k-frequent-elements/ 解题思路: 多了一个hashmap的排序 阅读全文
摘要:
解题思路: 乘着做这个题,顺便复习下堆排序。 先说堆排序是一个什么东西:https://blog.csdn.net/u013384984/article/details/79496052 大顶堆升序,小顶堆降序。 随便定义的一个堆。 第一步: 此时我们从最后一个非叶子结点开始(叶结点自然不用调整,第 阅读全文
摘要:
https://leetcode.com/problemset/top-interview-questions/ 阅读全文
摘要:
题目链接:https://leetcode.com/problems/intersection-of-two-linked-lists/ 解题思路: 两个链表的公共节点,首先让长的链表先走length1-length2步,然后一起走 阅读全文
摘要:
题目链接:https://leetcode.com/problems/same-tree/ 解题思路: 死鬼,如果p和q为空,那就相等。如果有一个为空,一个不为空,那就不等。然后两个值相等,那就递归判断下去。 阅读全文
摘要:
题目链接:https://leetcode.com/problems/reverse-linked-list-ii/ 解题思路: 阅读全文
摘要:
题目链接:https://leetcode.com/problems/binary-tree-inorder-traversal/ 解题思路: 二叉树的中序遍历。 阅读全文
摘要:
题目链接:https://leetcode.com/problems/word-search/ 解题思路: 这个题目和剑指offer上的路径问题是一样的,今天再次复习一下写法。 阅读全文
摘要:
题目链接: https://leetcode.com/problems/subsets/ 78: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The soluti 阅读全文