<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Coding on Rik Kisnah - Blog</title><link>https://www.rik-kisnah.ai/tags/coding/</link><description>Recent content in Coding on Rik Kisnah - Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 20 Jan 2026 09:00:00 -0800</lastBuildDate><atom:link href="https://www.rik-kisnah.ai/tags/coding/feed.xml" rel="self" type="application/rss+xml"/><item><title>Connected Components with Union-Find</title><link>https://www.rik-kisnah.ai/teach/coding/connected-components-union-find/</link><pubDate>Tue, 20 Jan 2026 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/connected-components-union-find/</guid><description>Given a list of friendships, how many separate friend groups are there? Everyone starts as their own group. Each friendship merges two groups. A tiny structure with two operations answers it almost instantly, and it is what real systems use to track which servers are in which cluster.</description></item><item><title>Subsets (Backtracking)</title><link>https://www.rik-kisnah.ai/teach/coding/subsets/</link><pubDate>Tue, 10 Jun 2025 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/subsets/</guid><description>Every possible group you can make from a set of items, including the empty group. For each item, choose to take it or leave it. That choose-then-undo rhythm is backtracking, and it is behind every &amp;lsquo;all combinations&amp;rsquo; question.</description></item><item><title>Sliding Window Maximum</title><link>https://www.rik-kisnah.ai/teach/coding/sliding-window-maximum/</link><pubDate>Tue, 13 Feb 2024 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/sliding-window-maximum/</guid><description>A window of size k slides along an array. For each position, what is the biggest number inside? A queue that throws away anything smaller than the newcomer answers it in one pass.</description></item><item><title>Meeting Rooms: How Many Rooms Do You Need</title><link>https://www.rik-kisnah.ai/teach/coding/meeting-rooms/</link><pubDate>Tue, 16 May 2023 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/meeting-rooms/</guid><description>A list of meetings with start and end times. What is the smallest number of rooms so nobody has to share? Sort by start, keep a heap of end times, and the size of the heap at its biggest is your answer.</description></item><item><title>Unique Paths</title><link>https://www.rik-kisnah.ai/teach/coding/unique-paths/</link><pubDate>Tue, 08 Mar 2022 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/unique-paths/</guid><description>A robot in the top-left corner of a grid can only move right or down. How many ways to reach the bottom-right? Every cell is the sum of the cell above and the cell to its left. Fill the grid once.</description></item><item><title>House Robber</title><link>https://www.rik-kisnah.ai/teach/coding/house-robber/</link><pubDate>Tue, 24 Aug 2021 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/house-robber/</guid><description>A street of houses with money inside. Rob any you like, but never two next to each other. At each house you choose: take it and skip the last one, or skip it and keep what you had. Two numbers, one walk down the street.</description></item><item><title>Climbing Stairs</title><link>https://www.rik-kisnah.ai/teach/coding/climbing-stairs/</link><pubDate>Tue, 16 Feb 2021 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/climbing-stairs/</guid><description>You can take one step or two. How many ways to reach the top? The answer is Fibonacci, but the lesson is how to see that the answer to a big question is built from the answers to two smaller ones.</description></item><item><title>Clone a Graph</title><link>https://www.rik-kisnah.ai/teach/coding/clone-graph/</link><pubDate>Tue, 13 Oct 2020 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/clone-graph/</guid><description>Make an exact copy of a graph where nodes point at each other, possibly in loops. The only new idea over a tree is a map from old node to new node, so you never copy anyone twice and never get stuck going round in circles.</description></item><item><title>Min Stack</title><link>https://www.rik-kisnah.ai/teach/coding/min-stack/</link><pubDate>Tue, 21 Apr 2020 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/min-stack/</guid><description>A stack that can tell you its smallest element instantly, at any moment. The answer is a second stack that remembers the smallest so far. Pay a little memory on every push to make one question free.</description></item><item><title>Flood Fill</title><link>https://www.rik-kisnah.ai/teach/coding/flood-fill/</link><pubDate>Tue, 03 Dec 2019 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/flood-fill/</guid><description>The paint bucket tool. Click a square, and every connected square of the same colour changes too. Spread to the four neighbours, stop at a different colour or the edge. It is the same search you will use on every grid problem after this one.</description></item><item><title>Validate a Binary Search Tree</title><link>https://www.rik-kisnah.ai/teach/coding/validate-a-binary-search-tree/</link><pubDate>Tue, 17 Sep 2019 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/validate-a-binary-search-tree/</guid><description>Is every node bigger than everything on its left and smaller than everything on its right? Checking only the children is the famous wrong answer. Carry a range down the tree instead.</description></item><item><title>Merge Intervals</title><link>https://www.rik-kisnah.ai/teach/coding/merge-intervals/</link><pubDate>Tue, 07 May 2019 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/merge-intervals/</guid><description>Sort your meetings by start time, then walk the calendar once. If the next one starts before the current one ends, stretch. This one shape covers half of all scheduling questions.</description></item><item><title>Invert a Binary Tree</title><link>https://www.rik-kisnah.ai/teach/coding/invert-a-binary-tree/</link><pubDate>Tue, 09 Oct 2018 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/invert-a-binary-tree/</guid><description>Swap left and right at every node. Three lines of recursion. The problem is a meme, but it is the cleanest test I know of whether you can trust a recursive call to do its job.</description></item><item><title>Merge Two Sorted Lists</title><link>https://www.rik-kisnah.ai/teach/coding/merge-two-sorted-lists/</link><pubDate>Tue, 22 May 2018 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/merge-two-sorted-lists/</guid><description>Two sorted queues. Keep taking the smaller front. A fake first node saves you from special-casing the start. This one shape is inside merge sort, log-structured databases, and every k-way merge you will ever write.</description></item><item><title>Intervals</title><link>https://www.rik-kisnah.ai/teach/coding/intervals/</link><pubDate>Tue, 27 Mar 2018 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/intervals/</guid><description>Start and end pairs: meetings, bookings, ranges. Sort them and the mess becomes a line you walk once. Sort by start to merge. Sort by end to pick the most that fit. The only question at each step is whether the next one starts before the current one ends.</description></item><item><title>Detect a Cycle in a Linked List</title><link>https://www.rik-kisnah.ai/teach/coding/linked-list-cycle/</link><pubDate>Tue, 28 Nov 2017 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/linked-list-cycle/</guid><description>Two runners on a track. If the track is a loop, the fast one laps the slow one. If it is a straight road, the fast one falls off the end. No memory needed.</description></item><item><title>Sliding Window, Fixed Length</title><link>https://www.rik-kisnah.ai/teach/coding/sliding-window-fixed-length/</link><pubDate>Tue, 03 Oct 2017 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/sliding-window-fixed-length/</guid><description>Find the best run of exactly k items in a row. Do not re-add the window every time it moves. Add the one coming in, subtract the one going out. One pass, and the same trick works for sums, counts and letters.</description></item><item><title>Binary Search</title><link>https://www.rik-kisnah.ai/teach/coding/binary-search/</link><pubDate>Tue, 22 Aug 2017 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/binary-search/</guid><description>Guess my number between 1 and 100. Always guess the middle. Seven guesses, every time. The off-by-one errors are where the interview happens.</description></item><item><title>Best Time to Buy and Sell Stock</title><link>https://www.rik-kisnah.ai/teach/coding/best-time-to-buy-and-sell-stock/</link><pubDate>Tue, 14 Mar 2017 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/best-time-to-buy-and-sell-stock/</guid><description>Prices for each day. Buy once, sell once later, make the most money. Walk the days once, remembering only the cheapest price so far. The lesson is what to carry and what to throw away.</description></item><item><title>Stacks</title><link>https://www.rik-kisnah.ai/teach/coding/stacks/</link><pubDate>Tue, 21 Feb 2017 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/stacks/</guid><description>A pile of plates. You only ever touch the top one. That is enough to match brackets, undo edits, unwind nested things, and find the next bigger number for every item in one pass. Learn the three shapes and you have the whole family.</description></item><item><title>Container With Most Water</title><link>https://www.rik-kisnah.ai/teach/coding/container-with-most-water/</link><pubDate>Tue, 08 Nov 2016 09:00:00 -0800</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/container-with-most-water/</guid><description>Vertical walls of different heights. Pick two that hold the most water between them. Start with a finger at each end and always move the shorter wall inward. Same shape as sorted Two Sum, and the lesson is why the move is safe.</description></item><item><title>Move Zeroes</title><link>https://www.rik-kisnah.ai/teach/coding/move-zeroes/</link><pubDate>Tue, 19 Jul 2016 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/move-zeroes/</guid><description>Push every zero to the end of the array without changing the order of everything else. One finger marks where the next non-zero belongs. That finger is the whole idea behind two pointers.</description></item><item><title>Two Sum</title><link>https://www.rik-kisnah.ai/teach/coding/two-sum/</link><pubDate>Tue, 14 Jun 2016 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/two-sum/</guid><description>Find two numbers in a list that add up to a target. Unsorted list: remember what you have seen in a hash map. Sorted list: one finger at each end, walk them towards each other. Two tricks, one problem, and half of the array questions you will ever be asked.</description></item><item><title>Reverse a Linked List</title><link>https://www.rik-kisnah.ai/teach/coding/reverse-a-linked-list/</link><pubDate>Tue, 12 Apr 2016 09:00:00 -0700</pubDate><guid>https://www.rik-kisnah.ai/teach/coding/reverse-a-linked-list/</guid><description>Three fingers, one loop. The first pointer problem every interviewer asks, and the first one where candidates lose the thread.</description></item></channel></rss>