Practice. Ship. Repeat.
Hand-picked problems across 6 languages — banking, e-commerce, analytics, system design. Run them right in your browser; ask AI when stuck.
FizzBuzz 1–15
Print numbers 1 to 15. Replace multiples of 3 with 'Fizz', multiples of 5 with 'Buzz', and multiples of both with 'FizzBuzz'.
Two Sum (Banking)
You're auditing a set of transaction amounts and need to find two transactions that together reconcile to exactly `target`. Return the 0-based indices of the two transactions. Exactly one solution exists.
FizzBuzz (Marketing Dashboard)
Print 1..n. Replace multiples of 3 with 'Fizz', multiples of 5 with 'Buzz', both with 'FizzBuzz'.
Flatten Nested Array to Depth N
Implement `flat(arr, depth)` without using the built-in `Array.prototype.flat`.
Build an EventEmitter
Implement a Node-style EventEmitter with `on`, `off`, `emit`, and `once`. Foundation of every pub/sub system.
Serialize a Binary Tree
Serialize a binary tree to a string and deserialize it back. A classic system-design interview question — how would you transmit a tree over a network? Use level-order with `null` sentinels.
Reverse a Singly Linked List
Given a linked list built from stdin, reverse it and print the new order.
0/1 Knapsack
You can carry at most W kg. Each of n items has a weight and value. Maximize total value without exceeding W.
Edit Distance (DP)
Given two strings, compute the minimum number of insert/delete/replace operations to transform one into the other.
Employee With Manager Name
Self-join `employees(id, name, manager_id)` to return each employee with their manager's name. CEOs (NULL manager_id) should appear with manager 'N/A'.
Calendar × Stores Heatmap
Given `dates(d)` (a 7-day calendar) and `stores(id)` (3 stores), CROSS JOIN them and LEFT JOIN to `sales(d, store_id, total)` so missing days show 0. Output (d, store_id, total).
Nth Highest Salary Per Dept
From `employees(dept_id, name, salary)` return the **2nd highest** salaried employee in each dept (NULL if dept has only one employee).
Day-Over-Day Sales % Change
Given `daily_sales(d, total)` (continuous days), output (d, total, prev_total, pct_change). pct_change = NULL on day 1.
Bucket Users Into Percentile Quartiles
Given `users(id, ltv)`, label each user 'Q1'..'Q4' based on LTV quartiles. Q1 = highest 25%, Q4 = lowest 25%. Output (id, ltv, bucket).
Median Salary Per Department
From `employees(dept_id, salary)`, compute the **median** salary per dept. Output (dept_id, median_salary). Even-count depts: average the two middle values.
Why `LIKE '%foo'` Can't Use an Index
Why does `WHERE email LIKE '%@gmail.com'` ignore the index on `email` even when one exists? Propose two practical mitigations.
Choosing Composite Index Column Order
A frequent query is `WHERE country = ? AND city = ? AND signup_d >= ?`. Should you create the index as `(country, city, signup_d)` or `(signup_d, country, city)`? Explain.
Functions On Indexed Columns Kill Indexes
`WHERE LOWER(email) = 'a@x.com'` ignores the index on `email`. Explain why, and propose two fixes.
Is Palindrome?
Write isPalindrome(s) that returns true if s reads the same backwards. Log isPalindrome('level') and isPalindrome('hello').
Fibonacci Sequence
Print the first 10 Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34).
Reverse a String
Reverse a given string without using Python's built-in slice `[::-1]` — demonstrate the two-pointer technique.
Group E-Commerce Orders by Customer
You're given `n` order lines from an online store. Each line has a customer ID and an amount. Compute the total revenue per customer and print customers in ascending order of ID.
Count Even & Odd (Analytics)
Read n integers and print the count of evens and count of odds on a single line.
Merge Overlapping Intervals
Given n meeting time intervals, merge any overlapping ones and print the result in ascending order. The classic calendar-app interview problem.
