DEV Community

Cover image for 12 Coding Pattern Scenario Questions That Expose Real Gaps
Nikhil Kamani
Nikhil Kamani

Posted on

12 Coding Pattern Scenario Questions That Expose Real Gaps


I have 13 years of Java experience and have interviewed hundreds of developers at MNCs. Most candidates know the 14 major coding patterns by name. Fewer can look at a fresh problem and instantly know which one fits — that's the actual skill being tested. Here's the mapping.

  1. Find if a sorted array has two numbers that sum to a target, without extra space → Two Pointers

  2. Find the longest substring without repeating characters → Sliding Window

  3. Group a list of words into anagram sets → Hash Map / Frequency Counter

  4. Answer many "sum between index i and j" queries efficiently, without recalculating each time → Prefix Sum

  5. Find an element in a rotated sorted array in O(log n) → Binary Search and Variants

  6. Check if a string of brackets is balanced → Stack-Based Problems

  7. Find the maximum sum of any contiguous subarray → Greedy / Kadane's Algorithm

  8. Find the shortest path between two nodes in an unweighted graph → Tree/Graph Traversal (BFS)

  9. Find the maximum value of items that fit in a knapsack of limited capacity → Dynamic Programming (Pick / No-Pick)

  10. Find the longest common subsequence between two strings → Dynamic Programming (Sequence Matching)

  11. Generate all valid combinations of balanced parentheses → Backtracking

  12. Find the Kth largest element in an unsorted array without fully sorting it → Quick Select


I put together a complete backend interview guide covering Core Java, Java 8-21, Multithreading, Spring Boot, Microservices, Design Patterns, and Coding Round Patterns.

Full guide: https://kamaninikhil.gumroad.com/l/java-interview-guide

Feedback or questions? Email me: kamaninikhil71@gmail.com

Bookmark this — which one do you always blank on when you're under pressure?

Top comments (0)