Skip to content

Latest commit

 

History

History
140 lines (110 loc) · 10.5 KB

File metadata and controls

140 lines (110 loc) · 10.5 KB

Coding Interview Preparation

This repository provides a curated list of algorithm techniques along with associated practice problems to help you master common patterns used in coding interviews and competitive programming.

1. Arrays

  • Sorting:
    • QuickSort: Efficient average-case time complexity (O(nlog n)).
    • MergeSort: Stable sort, useful when order matters (O(nlog n)).
  • Searching:
    • Binary Search: Fast search in sorted arrays (O(log n)).
  • Two Pointers:
    • In-place manipulation, often for sorted arrays (e.g., removing duplicates).
  • Sliding Window:
    • Subarray problems, finding maximum/minimum within a window.

2. Linked Lists

  • Traversal: Iterate through the list, understand the node structure.
  • Insertion/Deletion: At beginning, end, or at a specific position.
  • Reversal: In-place reversal, recursive and iterative approaches.
  • Cycle Detection: Floyd's Tortoise and Hare algorithm.

3. Hash Tables (Hash Maps/Sets)

  • Understand how hash functions work.
  • Insertion/Deletion/Lookup.
  • Collision Handling.

4. Trees

  • Traversal: Inorder, Preorder, Postorder (recursive and iterative).
  • Searching: Find a node with a given value (especially in BSTs).

5. Stacks

  • Understand Push/Pop/Peek operations.

6. Queues

  • Understand Enqueue/Dequeue operations.

7. Heaps (Priority Queues)

  • Operations: Insertion/Deletion (extract-min/max).
  • Top K Elements: Using a heap to find k largest/smallest elements.

8. Graphs

  • Traversal: BFS, DFS.
  • Shortest Path: Dijkstra's Algorithm.
  • Cycle Detection: DFS.

9. Tries

  • Implement Trie from scratch.
  • Insertion/Searching: For words/prefixes.
  • Autocompletion: Using a trie for word suggestions.

10. Union-Find (Disjoint Set)

  • Implement Union-Find from scratch.
  • Find/Union operations.
  • Cycle Detection in undirected graphs.

General Algorithms/Techniques

1. Recursion

Defining a problem in terms of itself, often leading to elegant and concise solutions.

2. Dynamic Programming

Breaking down a problem into overlapping subproblems and storing solutions to avoid recomputation.

3. Greedy Algorithms

Making locally optimal choices at each step with the hope of finding a global optimum.

4. Backtracking

Incrementally building solutions, exploring all possible paths, and abandoning invalid ones.

Begineer Friendly 100 Leetcode questions: here

Amazon Popular Questions

S.N. Problem Name Difficulty Level Solution Leetcode Link
1 Merge Intervals Medium Solution Leetcode Link
2 Insert Interval Medium Solution Leetcode Link
3 Number of Islands Medium DFS: Solution, BFS: Solution Leetcode Link
4 Search Suggestions System Medium - Leetcode Link
5 Best Time to Buy and Sell Stock Easy - Leetcode Link
6 Group Anagrams Medium - Leetcode Link
7 Longest Substring Without Repeating Characters Medium - Leetcode Link
8 K Closest Points to Origin Medium - Leetcode Link
9 Merge K Sorted Lists Hard - Leetcode Link
10 Trapping Rain Water Hard - Leetcode Link
11 3Sum Medium - Leetcode Link
12 Valid Parentheses Easy - Leetcode Link
13 Word Ladder Hard - Leetcode Link
14 Median of Two Sorted Arrays Hard - Leetcode Link
15 Add Two Numbers Medium - Leetcode Link
16 Word Search Medium - Leetcode Link
17 Maximum Subarray Easy - Leetcode Link
18 Merge Strings Alternately Easy Solution Leetcode Link
19 Meeting Rooms II Medium Solution Leetcode Link
20 Identify the Largest Outlier in an Array Medium Solution Leetcode Link
21 Task Scheduler Medium Solution Leetcode Link

Popular Begineer Friendly Top 100 list of Leetcode Questions

Other Coding Interview Problems - Leetcode

S.N. Problem Name Difficulty Level Solution Leetcode Link
1 Two Sum Problem Easy Two Sum Solution
2 3 Sum Problem Difficult 3 Sum Solution
3 Smallest Difference Problem Easy Smallest Difference Solution
4 Move Element-to-end Problem Easy Move Element-to-end Solution
5 Monotonic Array Problem Difficult Monotonic Array Solution
6 Spiral Traverse Problem Easy Monotonic Array Solution
7 Merge Sorted Array Easy Merge Sorted Array Solution Leetcode Question Link
8 Remove Element Easy Remove Element Solution Leetcode Question Link
9 Remove Duplicate Element Easy Remove Duplicate Element Solution Leetcode Question Link
10 Remove Duplicate Element-II Medium Remove Duplicate Element-II Solution Leetcode Question Link
11 Majority Element Easy Majority Element Solution Leetcode Question Link
12 Rotate Array Medium Rotate Array Solution Leetcode Question Link
13 Best Time to buy and sell stock Easy Solution Leetcode Question Link
14 Best Time to buy and sell stock-II Medium Solution Leetcode Question Link
15 Jump Game Easy Solution Leetcode Question Link
16 Jump Game-II Medium Solution Leetcode Question Link
17 H-Index Medium Solution Leetcode Question Link
18 H-Index-II Medium Solution Leetcode Question Link
19 Insert Delete GetRandom O(1) Medium Solution Leetcode Question Link
20 Product of Array Except Self Medium Solution Leetcode Question Link
21 Gas Station Medium Solution Leetcode Question Link
22 Candy Hard Solution Leetcode Question Link
23 Trapping Rain Water Hard Solution Leetcode Question Link
24 Roman To Integer Easy Solution Leetcode Question Link
25 Integer To Roman Medium Solution Leetcode Question Link
26 Two Sum Medium Solution Leetcode Question Link
27 Three Sum Medium Solution Leetcode Question Link

Best of Luck!