top of page

Find the Median from a Data Stream

Computing running medians on a stream of numbers pops up in real-time analytics, financial tickers, and sensor dashboards. You need to support two operations—adding a number and retrieving the current median—both in sublinear time.

Design an LRU Cache

Caching is critical in systems design, from web browsers to database engines. An LRU (Least Recently Used) cache evicts the least recently used entry when full, ensuring hot data stays accessible. Implementing one in code tests your mastery of linked lists, hash maps, and constant-time operations.

Merge k Sorted Lists

Combining multiple sorted streams into one sorted output is a classic challenge faced in database merge operations, log file aggregation, and external sorting. The “merge K sorted lists” problem tests your ability to coordinate multiple pointers, leverage priority data structures, and keep everything running in optimal time.

Contains Duplicate Within K Distance

Checking for nearby repeated events in a log or sensor stream is a common task in monitoring, fraud detection, and real‑time analytics....

Longest Consecutive Sequence

Finding the longest run of consecutive days, IDs, or timestamps in a dataset comes up in analytics, event processing, and scheduling systems. This “Longest Consecutive Sequence” problem is a great way to exercise hashing, set membership, and thinking about how to avoid redundant work.

Subarray Sum Equals K

Finding how many contiguous stretches of transactions sum to a target turns up in budgeting tools, analytics dashboards, and real‑time...

Group Anagrams

Clustering words that are anagrams of each other is a classic interview problem and mirrors real‑world tasks like building search indexes...

Design a Circular Queue

Circular queues (ring buffers) come up in real‑world systems like streaming data buffers, IO scheduling, and task schedulers. They let...

Evaluate Reverse Polish Notation

Reverse Polish Notation (RPN), also known as postfix notation, is a useful format for calculators and expression evaluation because it...

Min Stack

Maintaining a stack that can return its minimum value in constant time is a neat warm‑up that mirrors real‑world needs like tracking the...

Implement a Queue Using Stacks

Building a queue out of stacks is a classic exercise in adapting one data structure to mimic another. It’s not only a great warm‑up for...

Valid Parentheses

Checking whether a string of parentheses is valid is one of the most common warm‑ups in interviews. It’s directly applicable to parsing...

Intersection of Two Linked Lists

Finding the intersection node of two linked lists is like spotting the shared checkpoint in two runners’ paths—useful for debugging...

Add Two Numbers (Digits in Reverse)

Adding two numbers digit by digit in reverse order is a great warm‑up for handling arbitrary‑precision arithmetic in systems that store...

Palindrome Linked List

Checking whether a linked list reads the same forwards and backwards is a great warm‑up that mirrors real‑world tasks like validating...

Remove Nth Node

Removing the Nth node from the end of a linked list is a perfect warm-up for real-world tasks like trimming logs, pruning history...

Detect the Start of a Cycle

Finding not just whether a linked list has a cycle but exactly where that cycle begins is a real-world need whenever you’re dealing with...

Detect a Cycle

Detecting a cycle in a linked list is a classic problem that comes up when you need to guard against infinite loops—whether you’re...

Merge Two Sorted Lists

Merging two sorted linked lists is like merging two sorted streams of data—think combining two user event logs in chronological order....

Drop Me a Line, Let Me Know What You Think

Thanks for submitting!

© 2023 by Train of Thoughts. Proudly created with Wix.com

bottom of page