At the beginning of February 2020, I committed to a plan of writing about one algorithmic problem a day for 28 days. Here’s the list of tackled problems:
📝 Challenges Covered
- Alien Dictionary
- Binary Tree Path Sums
- Merging Binary Search Trees
- Minimum Palindromic Partitions
- Maximum Points on a Line
- Longest Non-Contiguous Non-Decreasing Subsequence
- Reversing Linked List Nodes in Groups Of K
- Partitioning an Array into K Equal Sum Subsets
- Maximum Profit from K Transactions (+ a review of DP)
- Connecting Cities at Minimum Cost (+ a review of priority queues)
- Largest Rectangle in Histogram
- Trapping Rain Water
- Trapping Rain Water (2D)
- Finding Bridges in a Graph
- Optimising Highway Networks (+ a review of shortest paths)
- Kth Smallest Element in Two Sorted Arrays
- Validating K-Palindromes
- The Skyline Problem
- Regular Expression Matching
- Detecting Arbitrage in Foreign Exchange Markets
- Smaller Numbers After Self
- Longest Subarray with a Sum Constraint
- Querying Range Sums
- Querying Range Sums (2D)
- Thinking About Partitions
- Huffman Coding
- Convex Hull
- Sliding Puzzle
Here’s two other problems I wrote about before February:
If you’d like to try these out yourself, check out this repo on Github.
Majority of the 28 questions fall within the so-called “Hard” range, but these difficulty labels are sometimes too subjective to be useful. I’d recommend just thinking of them as generic coding challenges.
If you’re looking to beef up your algorithmic problem-solving skills, feel free to bookmark this page so that you can visit these challenges anytime.
💖 Credits
Various communities (LeetCode, GeeksForGeeks) and materials (EPI, CLRS, MIT OpenCourseWare) were crucial in helping me grasp the intuition behind these problems. Most of what I’ve written is informed / inspired by the people behind these resources, which I highly recommend for your own learning journey.
🌻 Nice Things
Each article begins with an image of Singapore. These shots were taken by talented folks on Unsplash who chose to share their work freely.
✈️ What’s Next?
Coding challenges will always be fun to write about, but one’s ability to reverse a linked list or invert a binary tree isn’t constantly relevant to one’s day-to-day development work.
In the coming weeks, I’d like to go back to focusing on JavaScript while building stuff and things for the browser (e.g. Chrome extensions, UI components, mini apps).