Homepage
Open in app
Sign in
Get started
Array
Backtracking / DP / Greedy
Heap / Linked List
Two Pointers / Binary Search
Tree / Graph
Backend
Heap / Linked List
[Leetcode] Top K Frequent Elements
[Leetcode] Top K Frequent Elements
Use partial sorting to outperform O(nlogn).
PHIL
Feb 6, 2022
[Leetcode] Merge Two Sorted Lists
[Leetcode] Merge Two Sorted Lists
A classic linked list problem to practice switching attributes from nodes to nodes.
PHIL
Mar 31, 2022
[Leetcode] Sort List
[Leetcode] Sort List
The extension of Merge Two Sorted Lists. Linked lists make problem tricker. Still, the concept is the same as merge sort so…
PHIL
Apr 5, 2022
[Leetcode] Swap Nodes in Pairs
[Leetcode] Swap Nodes in Pairs
Use recursion to decrease and conquer the problem.
PHIL
Apr 27, 2022
[Leetcode] Merge k Sorted Lists
An extension of Merge Two Sorted Lists. Use heap to keep next pair (val, index) at the top. Shift head to next of target list for directly…
PHIL
May 5, 2022
[Leetcode] Reverse Nodes in k-Group
[Leetcode] Reverse Nodes in k-Group
An extension of Reverse Linked List. The essence is leveraging decrease and conquer.
PHIL
May 17, 2022
[Leetcode] Remove Nth Node From End of List
[Leetcode] Remove Nth Node From End of List
A good practice for slow fast pointers.
PHIL
Feb 2, 2022
[Leetcode] K Closest Points to Origin
[Leetcode] K Closest Points to Origin
heapq api in python makes this problem trivial.
PHIL
Apr 13, 2022
[Leetcode] Find Median from Data Stream
A very intricate usage of heap.
PHIL
May 10, 2022
[Leetcode] Find K Pairs with Smallest Sums
Perhaps the most counter-intuitive heap problem I’ve done so far.
PHIL
May 14, 2022
About Coding Memo
Latest Stories
Archive
About Medium
Terms
Privacy
Teams