[go: up one dir, main page]

0% found this document useful (0 votes)
21 views2 pages

Interview CheatSheet

This interview cheat sheet provides quick strategies for solving various coding problems, including techniques for sorted arrays, permutations, trees, graphs, linked lists, and dynamic programming. It emphasizes the use of data structures like hash maps, heaps, and tries for efficient operations. Additionally, it includes a note on SQL resources and credits the sources of the information provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Interview CheatSheet

This interview cheat sheet provides quick strategies for solving various coding problems, including techniques for sorted arrays, permutations, trees, graphs, linked lists, and dynamic programming. It emphasizes the use of data structures like hash maps, heaps, and tries for efficient operations. Additionally, it includes a note on SQL resources and credits the sources of the information provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Interview CheatSheet

Author : vee_daily19

This cheatsheet will be useful to anyone who wants a quick 2 minute review before an interview
to ensure they can identify solutions quickly. I must add that it is collected from many sources
and credit is due. Adding them at the bottom

1. Sorted input array:

●​ Binary Search: Quickly locate an item.


●​ Two Pointers: Efficiently find pairs or triplets with specific sums or differences.

2. Generate all permutations/subsets:

●​ Backtracking: Explore every possible combination systematically.

3. Tree or Graph problems:

●​ DFS (Depth-First Search): Deep exploration, good for paths, connectivity checks.
●​ BFS (Breadth-First Search): Level-wise exploration, ideal for shortest path, level-order
traversal.

4. Linked List problems:

●​ Two Pointers: Find mid-point, detect cycles, or reverse segments efficiently.

5. Recursion banned or limited stack space:

●​ Iterative Stack: Replace recursion explicitly with stacks for DFS and backtracking.

6. In-place solutions (constant space):

●​ Swap Values: Exchange elements directly.


●​ Store Multiple Values in Same Pointer: Encode/decode information in existing array or
pointers (e.g., negative marking, bit manipulation).

7. Maximum/Minimum Subarray or Subset problems:

●​ Dynamic Programming (DP): Solve by breaking down into sub-problems, storing


optimal solutions.

8. Top K or At-Least K items:

●​ Heap (Priority Queue): Quickly access largest/smallest elements.


●​ Quick Select: Average linear-time method to find kth largest/smallest element without
full sorting.

9. Common or Frequent String operations:

●​ Hash Map: Quick lookups, frequency counting, duplicates.


●​ Trie: Efficient prefix searches and autocomplete functionalities.

10. Default Optimization:

●​ Hash Map/Set: For O(1) average-time lookups, but O(n) space.


●​ Sort the input: Achieve O(log n) lookups/searches, leveraging ordering for reduced
space.
-​

Along with this the SQL guide is here :

Credits :

Zeromastery.io

Tech blog

Data structures

You might also like