Interview Prep
Interview questions, roadmaps and practice sets
Tutorials
Free tutorials on 30+ topics
Blog
Career guides, skills and interview tips
Free PDFs
Notes, cheat sheets and question banks
Certificates
Free skill tests and course certificates
Tools & Whiteboard
Free tools you can use right in the browser
Practice Tests
Mock tests, MCQs and quick Q&A
Free LMS
Learn on the Uncodemy LMS
Choose the best training program according to your career.
Improve the performance of your business with our innovative Industrial Training Program.
Read More →
Our instructor-led training classes are designed to make you an expert.
Read More →
Real-life case studies are a great way to demonstrate your practical knowledge.
Read More →
Explore blogs, latest technologies and industry updates with practical examples.
Read More →Browse all available training programs and choose the right one for your career.
Read More →Know more about who we are and what we stand for.
Discover our mission to equip individuals with essential IT skills and industry expertise.
Read More →
Free tutorials, interview questions, tools and calculators to help you learn.
Explore →Learn, practice and plan your career — bilkul free.
Book a free video counselling session and pick the right course for you.
Read More →Coding interviews test whether you can take an unfamiliar problem, reason about it out loud and reach correct, efficient code. Memorising hundreds of solutions does not do that; learning about a dozen problem patterns and practising one fixed way of talking through each problem does.
Below is that method applied to one real question, then the patterns, a preparation plan and the mistakes that cost offers.

Interviewers score the process, not only the final code. Here is how a strong candidate handles a common question: "Given a string, return the length of the longest substring without repeating characters."
Ask two or three short questions. Can the string be empty? Is it only lowercase letters, or any characters? Do you want the length or the substring itself? Here the answers are: it can be empty, any characters, return the length. Then confirm with an example: for "abcabcbb" the answer is 3, from "abc".
"I could check every substring and test whether its characters are unique. That is O(n²) substrings, and checking each costs up to O(n), so O(n³) overall." Saying this shows you can always produce a working answer, and it gives you something to improve.
"When I find a repeat, I don't need to restart. I can keep a window of unique characters and move its left edge just past the previous occurrence of the repeated character. If I store the last index of each character in a dictionary, each step is O(1)." This is the sliding-window pattern.
def longest_unique(s: str) -> int:
last = {} # character -> last index seen
start = best = 0 # left edge of window, best length so far
for i, ch in enumerate(s):
if ch in last and last[ch] >= start:
start = last[ch] + 1
last[ch] = i
best = max(best, i - start + 1)
return best
print(longest_unique("abcabcbb")) # 3
print(longest_unique("bbbbb")) # 1
print(longest_unique("pwwkew")) # 3
print(longest_unique("")) # 0
Walk through "abcabcbb": the window grows to abc (best = 3). At index 3 the second a appears; its last index 0 is inside the window, so start moves to 1. The window stays length 3 through index 5, then the repeated bs shrink it to length 2 and then 1. Final answer 3.
Then name edge cases: the empty string (loop never runs, returns 0), all characters equal (returns 1), and a repeat that is outside the current window, such as "abba". The check last[ch] >= start exists for exactly that case: at the final a, its last index 0 is before start (2), so the window must not move backwards.
Time O(n), since each character is visited once. Space O(k), where k is the number of distinct characters stored.
Clarify, brute force, optimise, code, test, complexity: use the same six steps in every practice session until they are automatic.
Most interview problems are variations of a small set of patterns. Learn to recognise the signal in the question:
| Pattern | Signal in the question | Typical problem |
|---|---|---|
| Hashing | "find a pair", "count occurrences" | Two Sum |
| Two pointers | sorted array, pairs from both ends | Container with most water |
| Sliding window | "longest/shortest contiguous subarray or substring" | The problem above |
| Prefix sums | repeated range-sum queries | Subarray sum equals K |
| Binary search | sorted data, or "minimum value that works" | Search in rotated array |
| Stack | matching brackets, "next greater element" | Valid parentheses |
| Linked list pointers | cycles, middle node, reversal | Detect a cycle |
| Tree DFS/BFS | depth, paths, level order | Maximum depth of a binary tree |
| Graph traversal | grids, connections, dependencies | Number of islands |
| Heap | "top K", "K-th largest", merging sorted lists | K-th largest element |
| Backtracking | "all combinations/permutations" | Subsets |
| Dynamic programming | "number of ways", "minimum cost", overlapping choices | Coin change |
Practise 5–8 problems per pattern, from easy to medium, before moving on. DSA problems asked at MNCs lists more examples, and free DSA practice websites lists where to solve them.
For a longer, topic-by-topic route, see the DSA roadmap for interview preparation.