🧑‍💻

DSA: Best practice questions to recap DSA

Week 1 - Sequences

In week 1, we will warm up by doing a mix of easy and medium questions on arrays and strings. Arrays and strings are the most common types of questions to be found in interviews; gaining familiarity with them will help in building strong fundamentals to better handle tougher questions.

Question
Difficulty
LeetCode
Contains Duplicate
Easy
Two Sum
Easy
Best Time to Buy and Sell Stock
Easy
Valid Anagram
Easy
Valid Parentheses
Easy
Maximum Subarray
Easy
Product of Array Except Self
Medium
3Sum
Medium
Merge Intervals
Medium
Group Anagrams
Medium

Optional

Question
Difficulty
LeetCode
Maximum Product Subarray
Medium
Search in Rotated Sorted Array
Medium

Week 2 - Data structures

The focus of week 2 is on linked lists, strings and matrix-based questions. The goal is to learn the common routines dealing with linked lists, traversing matrices and sequence analysis (arrays/strings) techniques such as sliding window, linked list traversal and matrix traversal.

Question
Difficulty
LeetCode
Reverse a Linked List
Easy
Detect Cycle in a Linked List
Easy
Container With Most Water
Medium
Find Minimum in Rotated Sorted Array
Medium
Longest Repeating Character Replacement
Medium
Longest Substring Without Repeating Characters
Medium
Number of Islands
Medium
Remove Nth Node From End Of List
Medium
Palindromic Substrings
Medium
Pacific Atlantic Water Flow
Medium
Minimum Window Substring
Hard

Week 3 - Non-linear data structures

The focus of week 3 is on non-linear data structures like trees, graphs and heaps. You should be familiar with the various tree traversal (in-order, pre-order, post-order) algorithms and graph traversal algorithms such as breadth-first search and depth-first search. In my experience, using more advanced graph algorithms (Dijkstra's and Floyd-Warshall) is quite rare and usually not necessary.

Question
Difficulty
LeetCode
Invert/Flip Binary Tree
Easy
Validate Binary Search Tree
Medium
Non-overlapping Intervals
Medium
Construct Binary Tree from Preorder and Inorder Traversal
Medium
Top K Frequent Elements
Medium
Clone Graph
Medium
Course Schedule
Medium
Serialize and Deserialize Binary Tree
Hard
Binary Tree Maximum Path Sum
Hard

Optional

Question
Difficulty
LeetCode
Maximum Depth of Binary Tree
Easy
Same Tree
Easy
Binary Tree Level Order Traversal
Medium
Encode and Decode Strings
Medium
Link (Premium)

Week 4 - More data structures

Week 4 builds up on knowledge from previous weeks but questions are of increased difficulty. Expect to see such level of questions during interviews. You get more practice on more advanced data structures such as (but not exclusively limited to) heaps and tries which are less common but are still asked.

Question
Difficulty
LeetCode
Subtree of Another Tree
Easy
Lowest Common Ancestor of BST
Medium
Implement Trie (Prefix Tree)
Medium
Add and Search Word
Medium
Kth Smallest Element in a BST
Medium
Merge K Sorted Lists
Hard
Find Median from Data Stream
Hard
Insert Interval
Medium
Longest Consecutive Sequence
Medium
Word Search II
Hard

Optional

Question
Difficulty
LeetCode
Meeting Rooms
Easy
Link (Premium)
Meeting Rooms II
Medium
Link (Premium)
Graph Valid Tree
Medium
Link (Premium)
Number of Connected Components in an Undirected Graph
Medium
Link (Premium)
Alien Dictionary
Hard
Link (Premium)

Week 5 - Dynamic programming

Week 5 focuses on Dynamic Programming (DP) questions. Personally as an interviewer, I'm not a fan of DP questions as they are not really applicable to practical scenarios and frankly if I were made to do the tough DP questions during my interviews I'd not have gotten the job. However, companies like Google still ask DP questions and if joining Google is your dream, DP is unavoidable.

DP questions can be hard to master and the best way to get better at them is... you guessed it - practice! Be familiar with the concepts of memoization and backtracking.

Practically speaking the return of investment (ROI) on studying and practicing for DP questions is very low. Hence DP questions are less important/optional and you should only do them if you have time to spare and you're very keen to have all bases covered (and interviewing with Google).

Question
Difficulty
LeetCode
Climbing Stairs
Easy
Coin Change
Medium
Longest Increasing Subsequence
Medium
Combination Sum
Medium
House Robber
Medium
House Robber II
Medium
Decode Ways
Medium
Unique Paths
Medium
Jump Game
Medium
Word Break
Medium

Dynamic programming course

SuperMade with Super