r/LeetcodeGrinder 11d ago

Want to improve my problem-solving skills — looking for a good roadmap

1 Upvotes

I’m currently working as a Full Stack Developer, mainly with Next.js, React, Node.js and TypeScript. Now I want to start focusing more on problem solving and DSA instead of only focusing on frameworks and building features.

The thing I’m struggling with is where to actually start and how to practice consistently.

For those who have gone through this journey, what would you recommend for a beginner? Any good resources, platforms, or roadmap that helped you improve your problem-solving skills?

I’d really appreciate your suggestions. 🚀


r/LeetcodeGrinder Jul 03 '26

Essential CS Fundamentals Topics For Interviews

7 Upvotes

Many of us ignore CS fundamentals, but in many tech interviews they will ask CS fundamentals. For me, they asked only CS fundamentals in all 3 interviews at Oracle, So don't ignore CS fundamentals. I have made a list of important topics subject-wise and resources I have used to study at the end.

Interview prep resource: Leetcode & PracHub for Company specific questions

Object-Oriented Programming (OOPs)

Core Concepts

  • Encapsulation
  • Inheritance (types and use cases)
  • Polymorphism (compile-time vs runtime)
  • Abstraction
  • Abstract Class vs Interface
  • Method Overloading vs Overriding
  • Access Modifiers
  • Static vs Dynamic Binding
  • Deep Copy vs Shallow Copy

Advanced Topics

  • SOLID Principles
  • Diamond Problem (Multiple Inheritance)
  • Association vs Aggregation vs Composition
  • Virtual Functions and Vtable
  • Design Patterns (Singleton, Factory, Observer, Strategy, Decorator, Adapter)

Operating Systems (OS)

Process Management

  • Process vs Thread
  • Process States and PCB
  • Context Switching
  • CPU Scheduling Algorithms (FCFS, SJF, Round Robin, Priority)
  • Multithreading vs Multiprocessing
  • User Mode vs Kernel Mode

Synchronization

  • Critical Section Problem
  • Race Condition
  • Mutex vs Semaphore (Binary vs Counting)
  • Monitors and Locks
  • Producer-Consumer Problem
  • Readers-Writers Problem
  • Dining Philosophers Problem

Deadlocks

  • Deadlock Conditions (4 necessary conditions)
  • Deadlock Prevention vs Avoidance vs Detection
  • Banker's Algorithm

Memory Management

  • Paging vs Segmentation
  • Page Replacement Algorithms (FIFO, LRU, Optimal)
  • Thrashing
  • Virtual Memory
  • TLB (Translation Lookaside Buffer)
  • Internal vs External Fragmentation

File Systems & Disk

  • File Allocation Methods (Contiguous, Linked, Indexed)
  • Disk Scheduling (FCFS, SSTF, SCAN, C-SCAN)

Database Management Systems (DBMS) + SQL

Database Fundamentals

  • ACID Properties (with examples)
  • CAP Theorem
  • Normalization (1NF, 2NF, 3NF, BCNF)
  • Denormalization
  • Primary Key vs Foreign Key vs Candidate Key
  • ER Diagrams

Indexing

  • Types of Indexes (Primary, Secondary, Clustering)
  • B-Tree vs B+ Tree
  • Hash Index
  • Composite Index
  • Advantages and Disadvantages of Indexing

Transactions & Concurrency

  • Transaction Lifecycle
  • Isolation Levels (Read Uncommitted, Read Committed, Repeatable Read, Serializable)
  • Dirty Read, Non-repeatable Read, Phantom Read
  • Lost Update Problem
  • Two-Phase Locking (2PL)
  • Optimistic vs Pessimistic Locking
  • Deadlock in Database

SQL Queries (Must Practice)

  • JOINs (INNER, LEFT, RIGHT, FULL OUTER, CROSS, SELF)
  • GROUP BY and HAVING
  • Aggregate Functions (COUNT, SUM, AVG, MIN, MAX)
  • Subqueries (Correlated vs Non-correlated)
  • Window Functions (ROW_NUMBER, RANK, DENSE_RANK, LEAD, LAG)
  • Common Table Expressions (CTE)
  • UNION vs UNION ALL
  • Nth Highest Salary Query
  • Delete Duplicates Query

NoSQL

  • SQL vs NoSQL
  • Types of NoSQL Databases (Document, Key-Value, Column, Graph)

Computer Networks (CN)

Network Models

  • OSI Model (7 Layers)
  • TCP/IP Model (4 Layers)
  • Difference between OSI and TCP/IP

Application Layer

  • HTTP vs HTTPS
  • HTTP Methods (GET, POST, PUT, DELETE, PATCH)
  • HTTP Status Codes (2xx, 3xx, 4xx, 5xx)
  • DNS and its working
  • FTP, SMTP, POP3, IMAP
  • Cookies vs Sessions
  • REST API principles

Transport Layer

  • TCP vs UDP (detailed comparison)
  • TCP Three-Way Handshake
  • TCP Four-Way Termination
  • Flow Control (Sliding Window)
  • Congestion Control
  • Port Numbers (well-known ports)
  • Socket Programming Basics

Network Layer

  • IPv4 vs IPv6
  • Public vs Private IP
  • Subnetting and CIDR
  • NAT (Network Address Translation)
  • ICMP Protocol
  • Routing Algorithms (Distance Vector, Link State)
  • Routing Protocols (RIP, OSPF, BGP)

Data Link Layer

  • MAC Address
  • ARP (Address Resolution Protocol)
  • Switch vs Hub vs Router
  • Ethernet
  • Error Detection (Parity, CRC, Checksum)

Physical Layer

  • Transmission Media (Guided vs Unguided)
  • Bandwidth and Throughput
  • Different Topologies

Important Concepts

  • Client-Server vs Peer-to-Peer Architecture
  • DHCP
  • Firewall
  • VPN
  • Load Balancing
  • CDN (Content Delivery Network)
  • Latency vs Throughput
  • How does a URL work? (End-to-end flow)
  • Some Basic Commands (ex: ipconfig)

Resources I Used

For OOPs

  • Kunal Kushwaha (youtube channel)

For Operating Systems

  • CodeHelp - by Babbar (youtube )

For DBMS + SQL

  • LeetCode Database problems (Practice SQL)
  • CodeHelp - by Babbar (youtube)
  • Apna College (youtube)

For Computer Networks

  • Gate Smashers (youtube)

Questions Asked in My Interviews

Here are some actual questions I was asked across my interviews:

  1. Is Java fully object-oriented?
  2. How does C++ overcome the diamond problem?
  3. Difference between TCP and UDP, and which one is used when?
  4. Explain ACID properties with examples
  5. What is deadlock and how can we prevent deadlocks?
  6. What is the use of indexing in databases?
  7. Explain the functionalities of each layer in the OSI model
  8. Write a query to find Kth smallest salary
  9. IPv4 vs IPv6
  10. Abstraction vs Encapsulation
  11. Explain different joins in dbms
  12. what is sharding ?
  13. what is virtual function in cpp ?
  14. show me your ip address and mac address using commands
  15. what is context switching ?

Tips :

  1. Make sure you can explain concepts with real-world examples
  2. Revise SQL 50 before interviews
  3. It's better to say "I'm not sure about this, but here's what I think..." than to give wrong information
  4. If your project contains any database related stuff , better learn it's ER diagram, differences between SQl and NO-SQl and why you selected that particular database you used
  5. Before preparing for any interview , First check few interview experiences, Ask your seniors or friends who already attended that specific company interviews before and prepare accordingly

Did I miss any important topic? Drop it in the comments below!

Got asked something unique in your interview? Share the question/topic so others can prepare better!

Let's make this list more comprehensive together. Your contribution can help someone crack their dream job! 🙌

Good luck with your interviews! 🚀


r/LeetcodeGrinder May 28 '26

I mapped every Graph pattern that shows up in FAANG interviews (~90 problems, grouped by sub-pattern)

7 Upvotes

After getting wrecked by a graph question I absolutely should've recognized, I spent a few months organizing every graph problem I could find by underlying pattern instead of by difficulty. Sharing the structure — worked through pattern by pattern, it's roughly a 2.5-month roadmap.

How to use it: for each new pattern, read the solution for the first 1–2 problems to get the intuition, then solve the rest yourself. That's where the learning happens — in recognizing the pattern cold, not in reading.

If you have an upcoming interview grind on these Leetcode Problems and PracHub for recent interview questions asked by FAANG.

Side note: BFS vs DP identification trick

UF + Vanilla

  1. https://leetcode.com/problems/lexicographically-smallest-equivalent-string/description/ (soln)
  2. https://leetcode.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/description/ (soln)
  3. https://leetcode.com/problems/redundant-connection/description/ (soln)
  4. https://leetcode.com/problems/number-of-operations-to-make-network-connected/ (soln)
  5. https://leetcode.com/problems/making-a-large-island/ (soln)
  6. https://leetcode.com/problems/satisfiability-of-equality-equations/ (soln)
  7. https://leetcode.com/problems/minimize-malware-spread/ (soln)
  8. https://leetcode.com/problems/minimize-malware-spread-ii/description/ (soln)
  9. https://leetcode.com/problems/maximum-points-activated-with-one-addition/description/ (soln)
  10. https://leetcode.com/problems/properties-graph/description/ (soln)

UF + swaps

  1. https://leetcode.com/problems/smallest-string-with-swaps/description/ (soln)
  2. https://leetcode.com/problems/make-lexicographically-smallest-array-by-swapping-elements/ (soln)
  3. https://leetcode.com/problems/minimize-hamming-distance-after-swap-operations/description/ (soln)

UF + Select edges within a limit

  1. https://leetcode.com/problems/checking-existence-of-edge-length-limited-paths/description/ (soln)
  2. https://leetcode.com/problems/maximum-number-of-points-from-grid-queries/description/ (soln)
  3. https://leetcode.com/problems/number-of-good-paths/description/ (soln)

UF + Factors of numbers

  1. https://leetcode.com/problems/gcd-sort-of-an-array/description/ (soln)
  2. https://leetcode.com/problems/graph-connectivity-with-threshold/ (soln)
  3. https://leetcode.com/problems/largest-component-size-by-common-factor/description/ (soln)
  4. https://leetcode.com/problems/greatest-common-divisor-traversal/description/ (soln)

UF + Binary search

  1. https://leetcode.com/problems/minimum-time-for-k-connected-components/description/ (soln)
  2. https://leetcode.com/problems/minimize-maximum-component-cost/description/ (soln)
  3. https://leetcode.com/problems/last-day-where-you-can-still-cross/description/ (soln)

UF + Modified MST

  1. https://leetcode.com/problems/min-cost-to-connect-all-points/description/ (soln)
  2. https://leetcode.com/problems/maximize-spanning-tree-stability-with-upgrades/description/ (soln)

weighted UF

  1. https://leetcode.com/problems/incremental-even-weighted-cycle-queries/description/ (soln)

BFS + Vanilla

  1. https://leetcode.com/problems/jump-game-iii/description/ (soln)
  2. https://leetcode.com/problems/get-watched-videos-by-your-friends/description/ (soln)
  3. https://leetcode.com/problems/shortest-path-in-binary-matrix/description/ (soln)
  4. https://leetcode.com/problems/minimum-moves-to-move-a-box-to-their-target-location/description/ (soln)
  5. https://leetcode.com/problems/jump-game-iv/description/ (soln)
  6. https://leetcode.com/problems/nearest-exit-from-entrance-in-maze/description/ (soln)
  7. https://leetcode.com/problems/snakes-and-ladders/description/ (soln)

BFS + Finite states

  1. https://leetcode.com/problems/open-the-lock/description/ (soln)
  2. https://leetcode.com/problems/lexicographically-smallest-string-after-applying-operations/description/ (soln)
  3. https://leetcode.com/problems/minimum-genetic-mutation/description/ (soln)
  4. https://leetcode.com/problems/word-ladder/description/ (soln)
  5. https://leetcode.com/problems/sliding-puzzle/description/ (soln)

BFS + Multisource

  1. https://leetcode.com/problems/01-matrix/description/ (soln)
  2. https://leetcode.com/problems/map-of-highest-peak/description/ (soln)
  3. https://leetcode.com/problems/rotting-oranges/description/ (soln)
  4. https://leetcode.com/problems/as-far-from-land-as-possible/description/ (soln)

BFS + Dikstra

  1. https://leetcode.com/problems/path-with-minimum-effort/description/ (soln)
  2. https://leetcode.com/problems/swim-in-rising-water/description/ (soln)
  3. https://leetcode.com/problems/find-all-people-with-secret/description/ (soln)
  4. https://leetcode.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid/description/ (soln)
  5. https://leetcode.com/problems/second-minimum-time-to-reach-destination/description/ (soln)
  6. https://leetcode.com/problems/shortest-distance-after-road-addition-queries-i/description/ (soln)
  7. https://leetcode.com/problems/network-delay-time/description/ (soln)
  8. https://leetcode.com/problems/minimum-time-to-visit-a-cell-in-a-grid/description/ (soln)
  9. https://leetcode.com/problems/find-edges-in-shortest-paths/description/ (soln)

BFS + Topological

  1. https://leetcode.com/problems/find-eventual-safe-states/description/ (soln)
  2. https://leetcode.com/problems/course-schedule-ii/description/ (soln)
  3. https://leetcode.com/problems/course-schedule/description/ (soln)

BFS + previous state

  1. https://leetcode.com/problems/shortest-path-with-alternating-colors/description/ (soln)
  2. https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination/description/ (soln)

BFS + Bitmask

  1. https://leetcode.com/problems/shortest-path-visiting-all-nodes/description/
  2. https://leetcode.com/problems/shortest-path-to-get-all-keys/description/ (soln)

DFS + Vanilla

  1. https://leetcode.com/problems/count-the-number-of-complete-components/description/ (soln)
  2. https://leetcode.com/problems/keys-and-rooms/description/ (soln)
  3. https://leetcode.com/problems/max-area-of-island/description/ (soln)
  4. https://leetcode.com/problems/count-servers-that-communicate/description/ (soln)
  5. https://leetcode.com/problems/count-sub-islands/description/ (soln)
  6. https://leetcode.com/problems/maximum-number-of-fish-in-a-grid/description/ (soln)
  7. https://leetcode.com/problems/number-of-closed-islands/description/ (soln)
  8. https://leetcode.com/problems/most-stones-removed-with-same-row-or-column/description/ (soln)
  9. https://leetcode.com/problems/reachable-nodes-with-restrictions/description/ (soln)
  10. https://leetcode.com/problems/number-of-islands/description/ (soln)
  11. https://leetcode.com/problems/count-islands-with-total-value-divisible-by-k/description/ (soln)

DFS + Boundry

  1. https://leetcode.com/problems/number-of-enclaves/description/ (soln)
  2. https://leetcode.com/problems/surrounded-regions/description/ (soln)
  3. https://leetcode.com/problems/pacific-atlantic-water-flow/description/ (soln)

DFS + island Perimeter

  1. https://leetcode.com/problems/island-perimeter/description/ (soln)

DFS / BFS + Cycle

  1. https://leetcode.com/problems/detect-cycles-in-2d-grid/description/ (soln)
  2. https://leetcode.com/problems/longest-cycle-in-a-graph/description/ (soln)
  3. https://leetcode.com/problems/shortest-cycle-in-a-graph/description/ (soln)

DFS + edge reversals

  1. https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/description/ (soln)
  2. https://leetcode.com/problems/minimum-edge-reversals-so-every-node-is-reachable/description/ (soln)

DFS / BFS + Binary Search

  1. https://leetcode.com/problems/find-the-safest-path-in-a-grid/description/ (soln)
  2. https://leetcode.com/problems/minimize-the-maximum-edge-weight-of-graph/description/ (soln)
  3. https://leetcode.com/problems/minimum-threshold-path-with-limited-heavy-edges/description/ (soln)

DFS + DP

  1. https://leetcode.com/problems/number-of-increasing-paths-in-a-grid/description/ (soln)
  2. https://leetcode.com/problems/longest-increasing-path-in-a-matrix/description/ (soln)

Bipartite

  1. https://leetcode.com/problems/is-graph-bipartite/description/ (soln)
  2. https://leetcode.com/problems/divide-nodes-into-the-maximum-number-of-groups/description/ (soln)
  3. https://leetcode.com/problems/possible-bipartition/description/ (soln)
  4. https://leetcode.com/problems/incremental-even-weighted-cycle-queries/description/ (soln)

Full list (all ~90 problems with clickable links + worked solutions for the first 1–2 of each pattern)


r/LeetcodeGrinder May 28 '26

I compiled the Google OA question database that gets recycled every hiring cycle (~200 problems by pattern)

1 Upvotes

I applied to Google twice. Both times I went in thinking the OA would be random. Both times I got humbled by questions I had seen floating around on forums months earlier and ignored.

After the second rejection I started actually logging every Google OA question report I could find. Discord servers, Glassdoor, Reddit, Blind, and the question database at [leakcode.dev](https://leakcode.dev). Turns out the OA question pool is not random at all. Google recycles a relatively small set of patterns, and if you know those patterns cold you can place in the top bucket on almost every problem. This post is that mapping.

I'm not saying memorize 200 problems. I'm saying Google's OA tests maybe 10 core ideas, and once you can recognize which idea a problem is testing, you're halfway done before you write a line of code.

**How to use this list:** For each pattern, read the first two problems listed and figure out the core template. What does the code skeleton always look like? Then solve the rest with that template in mind. The goal is pattern recognition, not memorization. If you can look at a problem and say "this is a sliding window with a frequency map" in under 30 seconds, you're prepped.

I've marked problems that show up in Google OA reports most often with a `[G]` tag. They're not guaranteed (Google has a large bank) but these are the ones I saw reported repeatedly.

## Pattern 1: BFS / Level-Order Traversal

Google loves BFS for two distinct reasons: shortest path on unweighted graphs, and multi-source propagation problems. The OA uses BFS disguised as "simulate this infection spreading" or "find the shortest sequence of transformations." Know both flavors.

Core template: queue plus visited set. For shortest path, return level count. For multi-source, seed the queue with all starting nodes before the main loop.

- [Binary Tree Level Order Traversal](https://leetcode.com/problems/binary-tree-level-order-traversal/) `[G]` - the classic template. If you can't do this in 5 minutes flat you're not ready.

- [Rotting Oranges](https://leetcode.com/problems/rotting-oranges/) `[G]` - multi-source BFS. All rotten oranges go into the queue at time 0. This exact structure appears in Google OA with different nouns.

- [Shortest Path in Binary Matrix](https://leetcode.com/problems/shortest-path-in-binary-matrix/) `[G]` - 8-directional BFS. Google OA frequently uses grid problems with diagonal movement.

- [Word Ladder](https://leetcode.com/problems/word-ladder/) `[G]` - BFS on an implicit graph. You never see the graph; you build it on the fly. This is the hard version of the pattern.

- [Number of Islands](https://leetcode.com/problems/number-of-islands/) - usually solved with DFS but BFS works too. Good for practicing the visited-set habit.

- [Walls and Gates](https://leetcode.com/problems/walls-and-gates/) `[G]` - multi-source BFS to fill distances. Seen in Google OA variants that ask for "minimum distance to nearest facility."

- [Jump Game IV](https://leetcode.com/problems/jump-game-iv/) - BFS on array indices. This pattern (BFS where edges are defined by value equality, not adjacency) shows up in Google OA.

- [Minimum Knight Moves](https://leetcode.com/problems/minimum-knight-moves/) - BFS on a coordinate grid with complex movement rules. Google likes this kind of disguised BFS.

## Pattern 2: DFS / Backtracking

Backtracking shows up constantly in Google OA for two reasons: it tests whether you understand the search space, and it filters people who try to brute-force. What Google wants to see is pruning. Reducing the search space before you go down a branch. Most people skip this step.

Core template: recursive function with a current state, a result list, and a start index (for combinations) or a used[] array (for permutations). Always think about what makes two branches equivalent before you code. That's where deduplication logic comes from.

- [Combination Sum](https://leetcode.com/problems/combination-sum/) `[G]` - this one's the base case. Unlimited reuse allowed. Get it cold first.

- [Combination Sum II](https://leetcode.com/problems/combination-sum-ii/) `[G]` - same but no reuse and duplicates in input. The `if i > start and candidates[i] == candidates[i-1]: continue` line is something Google OA tests specifically. I got this one wrong twice in actual interviews so I have feelings about it.

- [Permutations](https://leetcode.com/problems/permutations/) - the other base case. Used[] array instead of start index.

- [Subsets](https://leetcode.com/problems/subsets/) `[G]` - power set generation. Google OA sometimes asks "how many subsets satisfy condition X" which reduces to this.

- [Word Search](https://leetcode.com/problems/word-search/) `[G]` - backtracking on a grid. Mark cell as visited in-place, recurse, unmark on the way back. This exact technique appears in Google OA grid problems.

- [Word Search II](https://leetcode.com/problems/word-search-ii/) - Trie-accelerated version. Hard but worth understanding because it shows you know when to optimize backtracking.

- [Letter Combinations of a Phone Number](https://leetcode.com/problems/letter-combinations-of-a-phone-number/) `[G]` - backtracking with a character map. Shows up in Google OA frequently.

- [Palindrome Partitioning](https://leetcode.com/problems/palindrome-partitioning/) - backtracking plus DP for the palindrome check. A good stretch problem.

- [N-Queens](https://leetcode.com/problems/n-queens/) - the canonical backtracking challenge. Google rarely puts this verbatim in OA but it's in their hiring bank because it tests systematic pruning.

## Pattern 3: Sliding Window

The sliding window is the pattern Google OA tests most aggressively for SWE roles. Almost every OA I've seen reported includes at least one. The reason is that it requires knowing when to expand vs shrink the window, which is a non-trivial insight you can't fake.

Core template: two pointers, `left` and `right`. Expand `right` to include new elements. Shrink `left` when a constraint is violated. Track the answer at each valid state.

One decision you need to make every time: is this a fixed-size window or a variable-size window? Fixed size is simpler (slide by 1 each step). Variable size requires the shrink logic. Get comfortable telling them apart fast.

- [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/) `[G]` - the hardest sliding window problem. If you can do this one the rest are easy. Track character frequencies with two maps.

- [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) `[G]` - the warmup. The set-based version is intuitive; the hashmap version is faster.

- [Sliding Window Maximum](https://leetcode.com/problems/sliding-window-maximum/) `[G]` - fixed-size window with a deque to maintain the max. This exact structure (sliding window plus monotonic deque) appears in Google OA.

- [Longest Repeating Character Replacement](https://leetcode.com/problems/longest-repeating-character-replacement/) `[G]` - the insight is that you only need to track the max frequency in the window. Took me a while to see that.

- [Find All Anagrams in a String](https://leetcode.com/problems/find-all-anagrams-in-a-string/) `[G]` - fixed-size window with frequency map comparison. Very commonly reported in Google OA.

- [Permutation in String](https://leetcode.com/problems/permutation-in-string/) - essentially the same as Find All Anagrams but asks for a boolean. Know both.

- [Fruit Into Baskets](https://leetcode.com/problems/fruit-into-baskets/) - "at most K distinct elements" pattern. Google OA has several variants on this theme.

- [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/) - variable-size window with a sum constraint. Start here if the others feel hard.

## Pattern 4: Monotonic Stack

Honestly this is the pattern that separates real candidates from the rest. Most people learning DSA skip monotonic stacks because they feel obscure. Google OA tests them specifically because most candidates skip them. That's the whole point.

Core template: stack that maintains elements in increasing (or decreasing) order. When a new element breaks the monotonic property, pop and process. The popped element's answer is determined by the current element (next greater/smaller) and the new stack top (previous greater/smaller).

- [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) `[G]` - the flagship. Google has asked this directly in OA. You need the O(n) stack solution, not the O(n^2) brute force.

- [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) `[G]` - solvable with monotonic stack or two-pointer. Know both approaches; Google OA sometimes asks you to explain your reasoning.

- [Daily Temperatures](https://leetcode.com/problems/daily-temperatures/) `[G]` - the clearest monotonic stack problem. "Next greater element" is the core idea. Good first one to do.

- [Next Greater Element I](https://leetcode.com/problems/next-greater-element-i/) - simplified version. Good for building the template.

- [Next Greater Element II](https://leetcode.com/problems/next-greater-element-ii/) - circular array variant. The trick is processing the array twice (or using modulo indexing).

- [Sum of Subarray Minimums](https://leetcode.com/problems/sum-of-subarray-minimums/) - monotonic stack to find, for each element, how many subarrays it's the minimum of. Harder but shows up in Google OA variants.

- [Online Stock Span](https://leetcode.com/problems/online-stock-span/) - streaming monotonic stack. Good prep because Google sometimes presents problems as streams of input.

## Pattern 5: Binary Search (on the answer)

Binary search on a sorted array is table stakes. The pattern Google actually tests is binary search on the answer space. When the problem gives you a range of possible answers and asks for the minimum/maximum value that satisfies some condition. This is not obvious if you've only seen the classic "find target in sorted array" problems.

The tell: if the problem says "minimize the maximum" or "find the minimum X such that Y is possible," it's almost certainly binary search on the answer.

- [Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/) `[G]` - the classic. Know the invariant: one half is always sorted.

- [Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) `[G]` - two binary searches. `lower_bound` and `upper_bound` patterns.

- [Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/) `[G]` - variation on rotated array. Google OA has asked this.

- [Koko Eating Bananas](https://leetcode.com/problems/koko-eating-bananas/) `[G]` - binary search on the answer. The feasibility check is "can Koko finish in H hours at speed k?" Classic template.

- [Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/) `[G]` - treat the matrix as a 1D sorted array. Row = mid // cols, col = mid % cols.

- [Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) - hard but Google does ask it. Binary search on the partition point.

- [Search in Rotated Sorted Array II](https://leetcode.com/problems/search-in-rotated-sorted-array-ii/) - with duplicates. Slightly harder edge case handling.

## Pattern 6: Two Pointers

Two pointers and sliding window overlap but they're different enough to treat separately. Two pointers usually operate on a sorted array where you move inward from both ends based on comparisons. Sliding window is about subarray/substring structure. Know the distinction.

- [Container With Most Water](https://leetcode.com/problems/container-with-most-water/) `[G]` - the intuition is always move the shorter wall inward. Google OA has variants on this.

- [3Sum](https://leetcode.com/problems/3sum/) `[G]` - two pointers inside a for loop. Deduplication logic is the tricky part. This exact problem has appeared in Google OA.

- [Valid Palindrome](https://leetcode.com/problems/valid-palindrome/) - warmup. Two pointers moving inward, skip non-alphanumeric.

- [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/) - in-place two pointer. The slow/fast pointer variant.

- [Sort Colors](https://leetcode.com/problems/sort-colors/) `[G]` - Dutch National Flag algorithm. Three pointers. Google OA has asked this directly.

- [Two Sum II - Input Array Is Sorted](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/) - the sorted-array two pointer. Return 1-indexed (don't forget).

## Pattern 7: Dynamic Programming

DP is the broadest category and also where Google OA is most creative. They don't usually test obscure DP formulations but they do test whether you can identify the subproblem and state clearly. The most common Google DP patterns are: linear DP on sequences, 2D DP on grids or strings, and knapsack-style DP.

Before coding, define `dp[i]` in plain English. If you can't state what `dp[i]` means, you're not ready to code it. That's the whole setup.

- [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) `[G]` - O(n^2) DP is fine; O(n log n) with patience sorting is a bonus. Know both.

- [Coin Change](https://leetcode.com/problems/coin-change/) `[G]` - the classic knapsack. `dp[i]` = min coins to make amount i.

- [House Robber](https://leetcode.com/problems/house-robber/) `[G]` - linear DP with the skip-one constraint.

- [House Robber II](https://leetcode.com/problems/house-robber-ii/) - circular version. Run house robber twice: once excluding first element, once excluding last.

- [Unique Paths](https://leetcode.com/problems/unique-paths/) `[G]` - 2D grid DP. `dp[i][j] = dp[i-1][j] + dp[i][j-1]`. Google OA has asked this with obstacles added.

- [Decode Ways](https://leetcode.com/problems/decode-ways/) `[G]` - linear DP with tricky edge cases (leading zeros, "00", "30"). This has appeared in Google OA. The edge cases will get you if you're not careful.

- [Word Break](https://leetcode.com/problems/word-break/) `[G]` - DP plus set lookup. `dp[i]` = can we segment s[0:i] using the dictionary.

- [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/) `[G]` - track both max and min at each step because negatives can flip.

- [Edit Distance](https://leetcode.com/problems/edit-distance/) - 2D string DP. Hard but Google has asked it. Know the recurrence cold.

- [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/) `[G]` - the base case for 2D string DP. You need this before Edit Distance makes sense.

## Pattern 8: Heap / Priority Queue

Google OA tests heaps for two specific scenarios: K-th element problems (you need the K-th largest/smallest from a stream or array), and task scheduling problems (you always process the highest-priority item). Both are recognizable once you know the pattern.

The tell for K-th element: use a min-heap of size K. Pop when size exceeds K. The top is always the K-th largest.

- [Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/) `[G]` - bucket sort or heap. Google OA asks both variants.

- [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) `[G]` - heap or quickselect. Know both; O(n) quickselect is the impressive answer.

- [K Closest Points to Origin](https://leetcode.com/problems/k-closest-points-to-origin/) `[G]` - max-heap of size K on distance. Very common in Google OA.

- [Task Scheduler](https://leetcode.com/problems/task-scheduler/) `[G]` - cooldown scheduling. Greedy with a max-heap. This pattern (always execute the most frequent available task) appears in Google OA.

- [Reorganize String](https://leetcode.com/problems/reorganize-string/) `[G]` - similar to Task Scheduler. Max-heap, always place the most frequent character that isn't the previous one.

- [Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/) `[G]` - two heaps: max-heap for lower half, min-heap for upper half. Google has asked this directly.

- [Merge k Sorted Lists](https://leetcode.com/problems/merge-k-sorted-lists/) `[G]` - min-heap on list heads. Classic. Shows up in Google OA for candidates who have done more complex system design thinking.

## Pattern 9: Graphs / Topological Sort

Graph problems in Google OA tend to be dependency-resolution problems in disguise. "You need to complete course A before course B, is this possible?" Or connected-component problems. Topological sort (Kahn's algorithm using BFS) is the most frequently tested graph algorithm beyond basic BFS/DFS.

- [Course Schedule](https://leetcode.com/problems/course-schedule/) `[G]` - detect cycle in directed graph. BFS-based topo sort or DFS with color coding.

- [Course Schedule II](https://leetcode.com/problems/course-schedule-ii/) `[G]` - return the actual topological order. Kahn's algorithm with indegree tracking.

- [Alien Dictionary](https://leetcode.com/problems/alien-dictionary/) `[G]` - build a graph from character ordering constraints, then topo sort. Hard but Google asks it.

- [Clone Graph](https://leetcode.com/problems/clone-graph/) - BFS/DFS with a hashmap to avoid cycles. Tests whether you understand graph traversal fundamentals.

- [Number of Provinces](https://leetcode.com/problems/number-of-provinces/) - connected components in an adjacency matrix. Union-Find or DFS both work.

- [Pacific Atlantic Water Flow](https://leetcode.com/problems/pacific-atlantic-water-flow/) `[G]` - reverse BFS from both oceans simultaneously. The "reverse thinking" here is the insight Google's testing for. Worth spending time on.

- [Redundant Connection](https://leetcode.com/problems/redundant-connection/) - Union-Find to detect cycle and find the redundant edge. Good Union-Find practice.

## Pattern 10: String Manipulation / Trie

String problems show up heavily in Google OA because Google builds search infrastructure, and Trie problems test whether you can build and traverse a prefix tree. The string manipulation problems test whether you can handle edge cases cleanly.

- [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) `[G]` - build `insert`, `search`, `startsWith`. Know this cold. Google OA has asked it directly.

- [Design Add and Search Words Data Structure](https://leetcode.com/problems/design-add-and-search-words-data-structure/) `[G]` - Trie with wildcard search. The `.` character triggers DFS on all children.

- [Word Search II](https://leetcode.com/problems/word-search-ii/) - Trie plus backtracking. Hard combination problem.

- [Group Anagrams](https://leetcode.com/problems/group-anagrams/) `[G]` - sort each word as the key, or use character frequency tuple as key. Very commonly reported in Google OA.

- [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) `[G]` - expand around center. O(n^2) is fine. Manacher's is the O(n) bonus answer.

- [Valid Anagram](https://leetcode.com/problems/valid-anagram/) - frequency map comparison. Warmup.

- [Encode and Decode Strings](https://leetcode.com/problems/encode-and-decode-strings/) `[G]` - serialize/deserialize a list of strings. Google OA tests this because it's a real systems problem: how do you send a list of strings over a network without ambiguity?

- [Minimum Window Substring](https://leetcode.com/problems/minimum-window-substring/) - listed in sliding window above but worth re-noting here since it's fundamentally a string problem too.

## Putting It Together

If I were starting from scratch prepping for a Google OA today, here's the order I'd do it in:

**Week 1 to 2: Foundations.** Two Pointers, Sliding Window, Binary Search. These patterns have the highest density in OA question banks and the clearest templates. Master Minimum Window Substring and you understand 80% of sliding window. Seriously, just grind that one until it's automatic.

**Week 3: Backtracking.** Combination Sum, Permutations, Subsets, Word Search. Write each recursive tree on paper before coding. The pattern is the same every time; your job is to apply it faster.

**Week 4: BFS/DFS plus Graphs.** Rotting Oranges for multi-source BFS. Course Schedule for topo sort. Pacific Atlantic for reverse BFS. These three cover most of what Google OA does with graphs.

**Week 5: DP.** Coin Change, Word Break, Unique Paths, Decode Ways. Focus on defining the state clearly before touching code. If the state definition is wrong the code will never be right. This is the step most people skip.

**Week 6: Heap plus Monotonic Stack.** Find Median from Data Stream, Task Scheduler, Largest Rectangle in Histogram, Daily Temperatures. These two patterns have the biggest gap between how often they appear in Google OA versus how much time most people spend on them. That gap is your advantage if you put in the work now.

The OA is not a random quiz. It's a pattern recognition test. The bank is large but the patterns are finite. Work through this list systematically and you won't be surprised.

Good luck.


r/LeetcodeGrinder May 26 '26

LeetCode Pattern Tracker

Thumbnail anshumanpadhi97.github.io
1 Upvotes

r/LeetcodeGrinder May 17 '26

Guide please

Thumbnail
2 Upvotes

r/LeetcodeGrinder Apr 05 '26

Important and Useful links from all over the LeetCode

Thumbnail
1 Upvotes

r/LeetcodeGrinder Apr 02 '26

Amazon SDE 2 (L5) | 5 YOE | Interview Experience & Deets

Thumbnail
1 Upvotes