The TuringPath 150
150 coding interview problems grouped by pattern, from two pointers to dynamic programming, each with our own tests, hints and a lesson that teaches the idea. Solve in Python, JavaScript, Java, C++ or Rust.
Arrays & Hashing
- First Badge Scanned Twice (Easy)
- Spell It With Tiles (Easy)
- Two Parcels, Exact Load (Easy)
- First One-of-a-Kind Character (Easy)
- Group Words With the Same Letters (Medium)
- Trending Hashtags (Medium)
- Longest Streak of Floors (Medium)
- Everyone Else's Product (Medium)
- First Free Ticket Number (Hard, Pro)
- Most Lamp Posts in One Line (Hard, Pro)
Two Pointers
- Two Gifts for One Card (Easy)
- Mirror Sign Check (Easy)
- Squash Repeated Readings (Easy)
- Ledger Entries That Cancel Out (Medium)
- Biggest Tank Between Two Posts (Medium)
- Three Weights Closest to the Mark (Medium)
- Rain Caught on a Rooftop Row (Hard, Pro)
Sliding Window
- Food Stall Moving Average (Easy)
- Badge Scanned Twice Too Soon (Easy)
- Longest Stretch With No Repeat Song (Medium)
- Repaint Tiles for the Longest Run (Medium)
- Scrambled Code Hidden in a Log (Medium)
- Fewest Orders to Hit the Goal (Medium)
- Shortest Note That Covers Every Letter (Hard, Pro)
- Rolling Peak of a Sensor (Hard, Pro)
Prefix Sums
- Where the Seesaw Balances (Easy)
- Stretches That Hit the Goal (Medium)
- Batches That Split Evenly (Medium)
- Orchard Plot Totals (Medium)
- Plots With an Exact Harvest (Hard, Pro)
Stack & Monotonic Stack
- Config Bracket Check (Easy)
- Cancelling Beads (Easy)
- Calculator Tape (Easy)
- Lightest Parcel on the Pile (Medium)
- Banner Expander (Medium)
- Taller Friend at the Round Table (Medium)
- Scooter Convoys (Medium)
- Biggest Skyline Billboard (Hard, Pro)
Binary Search
- Biggest Square of Tiles (Easy)
- Bookings at One Minute (Easy)
- Find a Book on a Rotated Shelf (Medium)
- Earliest Entry in a Ring Log (Medium)
- Slowest Reading Pace (Medium)
- Fair Editing Shifts (Hard, Pro)
- K-th Cheapest Across Two Stores (Hard, Pro)
Linked Lists
- Merge Two Delivery Routes (Easy)
- Cancel the K-th Last Booking (Easy)
- Flip a Section of the Parade (Medium)
- Deal From Both Ends (Medium)
- Does the Treasure Hunt Loop? (Medium)
- Add Two Digit Chains (Medium)
Trees & BSTs
- Levels in the Org Chart (Easy)
- Mirror the Folder Tree (Easy)
- Twin Backup Check (Easy)
- Exact Budget Trail (Easy)
- Shared Boss in the ID Tree (Easy)
- Floor-by-Floor Roster (Medium)
- Unbeaten on the Way Down (Medium)
- Longest Handoff Chain (Medium)
- Shelf Index Check (Medium)
- K-th Cheapest Price (Medium)
- Closest Shared Folder (Medium)
- Rebuild the Bracket (Medium)
- Best Relay Route (Hard, Pro)
- Downhill Trails With a Target Sum (Hard, Pro)
- Office Wi-Fi Repeaters (Hard, Pro)
Heaps & Top-K
- Crate Crusher (Easy)
- Leaderboard Cut-Off (Easy)
- Closest Charging Stations (Easy)
- Top Songs of the Week (Medium)
- Oven Cooldown Planner (Medium)
- Merge Sorted Shelves (Medium)
- Seed Fund Planner (Hard, Pro)
- Thermostat Median Bill (Hard, Pro)
- One Reading From Every Sensor (Hard, Pro)
Graphs, BFS & DFS
- Repaint Connected Tiles (Easy)
- Largest Crop Field (Easy)
- Can the Van Get There? (Easy)
- Mold on the Bakery Shelf (Medium)
- Steps to the Nearest Fire Exit (Medium)
- Rain That Reaches Both Coasts (Medium)
- Fill the Landlocked Ponds (Medium)
- Copy a Network With New Labels (Medium)
- Shortest Clear Path for a Rover (Hard, Pro)
- Code Word Relay (Hard, Pro)
Union-Find
- Count the Rail Regions (Easy)
- Can These Devices Talk? (Easy)
- The Cable That Closes a Loop (Medium)
- Is the Pipe Network a Tree? (Medium)
- Merge Duplicate Contact Cards (Hard, Pro)
Topological Sort & Shortest Paths
- Finish Every Training Module (Easy)
- Alarm Across the Campus (Easy)
- Does One Skill Lead to Another? (Easy)
- Flip the Fewest One-Way Signs (Easy)
- Letters of a Made-Up Language (Medium)
- Fewest Terms to Graduate (Medium)
- Budget Trip With Few Layovers (Medium)
- The Gentlest Hike (Medium)
- Wire Up the Sensors (Medium)
- Pick the Quietest Depot (Medium)
- Rebuild the Travel Route (Medium)
- Cross Before the Flood (Hard, Pro)
- How Many Fastest Routes? (Hard, Pro)
- Earliest Launch Day (Hard, Pro)
- Toll Roads With Coupons (Hard, Pro)
Backtracking
- Every Snack Bundle (Easy)
- Every Seating Plan (Easy)
- Keypad Spellings (Easy)
- Distinct Gift Bags (Medium)
- Exact Change Stacks (Medium)
- Trace a Word on the Letter Board (Medium)
- Mirror Word Splits (Medium)
- Peaceful Queens Count (Hard, Pro)
Greedy & Intervals
- Stepping Stones Across the Creek (Easy)
- Artist Blocks in a Playlist (Easy)
- Squeeze In a Booking (Medium)
- Clear the Talk Schedule (Medium)
- Electric Bus Loop (Medium)
- Team Bonus Tokens (Hard, Pro)
- Road Trip Fuel Stops (Hard, Pro)
1-D Dynamic Programming
- Hop Routes Up the Stairs (Easy)
- Toll Steps to the Top (Easy)
- Stalls Around the Roundabout (Medium)
- Digit Message Decodings (Medium)
- Exact Change Machine (Medium)
- Unspaced Hashtag Split (Medium)
- Best Multiplier Streak (Medium)
- Longest Rising Readings (Hard, Pro)
2-D & String DP
- Warehouse Robot Routes (Easy)
- Lightest Hiking Route (Easy)
- Shared Travel Order (Medium)
- Longest Mirror Piece (Medium)
- Two Equal Delivery Vans (Medium)
- Plus or Minus Ledger (Medium)
- Fill the Cargo Bay Exactly (Medium)
- Ways to Pay the Toll (Medium)
- Priced Spelling Fix (Hard, Pro)
- Hidden Copies in a Log (Hard, Pro)
- File Filter Wildcards (Hard, Pro)
- Label Printer Tiles (Hard, Pro)
Tries & String Matching
- Shared Start of Product Codes (Easy)
- Search Box Counter (Easy)
- Shorten Words to Their Stems (Medium)
- Dictionary Words on a Letter Board (Hard, Pro)
- Signal in a Ring Buffer (Hard, Pro)
Bits & Math
- The Unpaired Sock (Easy)
- Lit Lamps on a Binary Counter (Easy)
- Mirror a 32-bit Register (Easy)
- Adder Circuit Without Plus (Medium)
- Compounding Sign-ups Total (Hard, Pro)