HANDS ON
Sairam!
Welcome to the Problem Solving Lab. The objective of this course is to equip the readers
(and students!) with problem solving skills, critical thinking and coursework with respect to
data structures and algorithms.
This lab material aims to give an overview of the syllabus, some problems from social
platforms such as leetcode.com, and hackerrank.com and tips and tricks to ace an
interview. There are already a ton of resources which do this, however this material is
tailor-made for our students (SSSIHL) keeping in mind the learning path and pace possible
in our current setup.
We thank Swami for giving us this opportunity to be part of this humble initiative to
collaborate with DMACS department in this mutual learning process.
TABLE OF CONTENTS
Course Overview ..............................................................................4
Evaluation ................................................................................................................4
Course Plan .......................................................................................5
Resources ..........................................................................................6
WEEK 1 ...................................................................................................................7
WEEK 2 ...................................................................................................................8
WEEK 3 ...................................................................................................................9
WEEK 4..................................................................................................................10
WEEK 5 ..................................................................................................................11
WEEK 6..................................................................................................................12
WEEK 7..................................................................................................................13
WEEK 8..................................................................................................................14
WEEK 9..................................................................................................................15
WEEK 10 ................................................................................................................16
Bonus: hard Problems ..............................................................................................17
References ......................................................................................19
COURSE OVERVIEW
Note: This lab manual is a continuous ongoing e ort to compile the course materials and best practices
Problem solving lab is a 2-credit course introduced in II M.Tech (2023) to help equip the students with
necessary hands on coding skills and various aspects of implementations of data structures and algorithms
to real-life problems.
This comprehensive lab course focuses not just on coding, but also various ner aspects of communication,
presentation and participation in group sessions to better prepare the students for their plunge into the
industry/corporate life. We have proposed 2 evaluation methods: Series Evaluations (SE) and Summative
Test (ST) for continuous and comprehensive evaluations.
E VA L UAT I O N
Series Evaluation (SE) includes (but not limited to) Assignments, Quizzes, Class Participation and
presentations, and Unit Tests throughout the semester.
Summative Test (ST) is conducted at the end of the semester to evaluate coding strengths, ability to
design and implement solutions within time-limits.
Final score is awarded for a total of 50 marks, with the nal score computed as follows
Final grade = 50% * SE + 50% * ST
(Total marks = 50)
ff
fi
fi
COURSE PLAN
Note: The rst set of sessions are planned from Nov 2023 - March 2024 (II M.Tech 2022 - 24)
Guidelines
• Sessions would be on every working Saturday from 9.20am IST - 10.20am IST.
• These sessions would be discussion and feedback driven rather than the traditional methods of teaching.
• Students are expected to solve the problems o ine and are to use the class hours to leverage
industry expertise and direct feedback from course teachers (or invited-speakers).
• Discussions would be around best practices, optimal solutions , time-space complexity tradeo etc.
• Depending on the availability of instructors, we will aim to have sub-group focused discussions to
provide individual attention to students (to our best possible ability).
• All students will be working in rotation with various alumni for an all-round experience and
varied perspectives.
• We will use social platforms such as leetcode.com for coding challenges and ease of submission and
tracking.
• Students are expected to follow the submission guidelines (and populate the gsheets) with their time-
tracking, and problem overview which will help them later during interviews.
• Weekly must-do problems are tracked in a master gsheet - Gsheet Link
• Problems with a in the title will be the graded ones for the nal assessment. Students are encouraged
to do all the problems to help them improve their coding skills.
fi
ffl
fi
ff
RESOURCES
Note: This is not an exhaustive list - expect continuous updates to the coming sections
Leetcode is initially a muscle-memory game, and over time becomes an intellectually challenging fun-
process. As students entering industry (and people looking for a job-change) we need to be thorough with
the basics of implementation of linked-lists, queue, stacks, trees etc. After a certain point, when the basics
are covered, we will move on to learning tips-and-tricks, to help optimise on time and space complexity of
various problems.
We will be using the following resources as reference for this lab (for coding)
• Leetcode Patterns
• https://seanprashad.com/leetcode-patterns/
• Blind 75 Questions
• https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions
• Lesson plan
• https://www.techinterviewhandbook.org/grind75
• Neetcode 150
• https://leetcode.com/list/rr2ss0g5/
• Neetcode RoadMap
• https://neetcode.io/roadmap
WEEK 1
Problem Name Leetcode Link
1. Contains Duplicate https://leetcode.com/problems/contains-duplicate
2. Missing Number https://leetcode.com/problems/missing-number
3. Find All Numbers https://leetcode.com/problems/find-all-numbers-disappeared-in-an-
Disappeared in an Array array
4. Single Number https://leetcode.com/problems/single-number
5. Climbing Stairs https://leetcode.com/problems/climbing-stairs
6. Best Time to Buy and Sell
https://leetcode.com/problems/best-time-to-buy-and-sell-stock
Stock
are compulsory and graded
7. Range Sum Query -
https://leetcode.com/problems/range-sum-query-immutable
Immutable
8. Counting Bits https://leetcode.com/problems/counting-bits
9. Linked List Cycle https://leetcode.com/problems/linked-list-cycle
Problems marked
10. Middle of the Linked List https://leetcode.com/problems/middle-of-the-linked-list
11. Reverse Linked List https://leetcode.com/problems/reverse-linked-list
12. Palindrome Linked List https://leetcode.com/problems/palindrome-linked-list
13. Remove Linked List Elements https://leetcode.com/problems/remove-linked-list-elements
14. Remove Duplicates from
https://leetcode.com/problems/remove-duplicates-from-sorted-list
Sorted List
15. Merge Two Sorted Lists https://leetcode.com/problems/merge-two-sorted-lists
Patterns: Arrays, Dynamic Programming, 2-pointers
WEEK 2
Problem Name Leetcode Link
16. Meeting Rooms https://leetcode.com/problems/meeting-rooms
17. Binary Search https://leetcode.com/problems/binary-search
18. Find Smallest Letter Greater Than https://leetcode.com/problems/find-smallest-letter-greater-
Target than-target
https://leetcode.com/problems/average-of-levels-in-binary-
19. Average of Levels in Binary Tree tree
https://leetcode.com/problems/minimum-depth-of-binary-
20. Minimum Depth of Binary Tree tree
21. Same Tree https://leetcode.com/problems/same-tree
22. Path Sum https://leetcode.com/problems/path-sum
https://leetcode.com/problems/maximum-depth-of-binary-
23. Maximum Depth of Binary Tree tree
are compulsory and graded
24. Diameter of Binary Tree https://leetcode.com/problems/diameter-of-binary-tree
25. Merge Two Binary Trees https://leetcode.com/problems/merge-two-binary-trees
26. Subtree of Another Tree https://leetcode.com/problems/subtree-of-another-tree
Problems marked
27. Invert Binary Tree https://leetcode.com/problems/invert-binary-tree
28. Two Sum https://leetcode.com/problems/two-sum
29. Squares of a Sorted Array https://leetcode.com/problems/squares-of-a-sorted-array
30. Backspace String Compare https://leetcode.com/problems/backspace-string-compare
31. Index Pairs of a String https://leetcode.com/problems/index-pairs-of-a-string
32. Majority Element https://leetcode.com/problems/majority-element
https://leetcode.com/problems/convert-1d-array-into-2d-
33. Convert 1D Array Into 2D Array array
34. Move Zeroes https://leetcode.com/problems/move-zeroes
35. Is Subsequence https://leetcode.com/problems/is-subsequence
Patterns: DFS, BFS, 2-pointers
WEEK 3
Problem Name Leetcode Link
36. Binary Tree Paths https://leetcode.com/problems/binary-tree-paths
https://leetcode.com/problems/maximum-average-
37. Maximum Average Subarray I subarray-i
38. Product of Array Except Self https://leetcode.com/problems/product-of-array-except-self
39. Find the Duplicate Number https://leetcode.com/problems/find-the-duplicate-number
https://leetcode.com/problems/find-all-duplicates-in-an-
40. Find All Duplicates in an Array array
41. Set Matrix Zeroes https://leetcode.com/problems/set-matrix-zeroes
are compulsory and graded
42. Spiral Matrix https://leetcode.com/problems/spiral-matrix
43. Rotate Image https://leetcode.com/problems/rotate-image
Problems marked
44. Word Search https://leetcode.com/problems/word-search
https://leetcode.com/problems/longest-consecutive-
45. Longest Consecutive Sequence sequence
46. Letter Case Permutation https://leetcode.com/problems/letter-case-permutation
47. Subsets https://leetcode.com/problems/subsets
48. Subsets II https://leetcode.com/problems/subsets-ii
49. Permutations https://leetcode.com/problems/permutations
50. Permutations II https://leetcode.com/problems/permutations-ii
Patterns: Arrays, Backtracking
WEEK 4
Problem Name Leetcode Link
51. Combinations https://leetcode.com/problems/combinations
52. Combination Sum https://leetcode.com/problems/combination-sum
53. Combination Sum II https://leetcode.com/problems/combination-sum-ii
54. Combination Sum III https://leetcode.com/problems/combination-sum-iii
55. Generate Parentheses https://leetcode.com/problems/generate-parentheses
56. Target Sum https://leetcode.com/problems/target-sum
are compulsory and graded
57. Palindrome Partitioning https://leetcode.com/problems/palindrome-partitioning
58. Letter Combinations of a Phone https://leetcode.com/problems/letter-combinations-of-a-
Number phone-number
Problems marked
59. Generalized Abbreviation https://leetcode.com/problems/generalized-abbreviation
60. House Robber https://leetcode.com/problems/house-robber
61. Maximum Subarray https://leetcode.com/problems/maximum-subarray
62. House Robber II https://leetcode.com/problems/house-robber-ii
63. Coin Change https://leetcode.com/problems/coin-change
64. Maximum Product Subarray https://leetcode.com/problems/maximum-product-subarray
https://leetcode.com/problems/longest-increasing-
65. Longest Increasing Subsequence subsequence
Patterns: Dynamic Programming, Backtracking
WEEK 5
Problem Name Leetcode Link
https://leetcode.com/problems/longest-palindromic-
66. Longest Palindromic Substring substring
67. Word Break https://leetcode.com/problems/word-break
68. Combination Sum IV https://leetcode.com/problems/combination-sum-iv
69. Decode Ways https://leetcode.com/problems/decode-ways
70. Unique Paths https://leetcode.com/problems/unique-paths
71. Jump Game https://leetcode.com/problems/jump-game
are compulsory and graded
72. Palindromic Substrings https://leetcode.com/problems/palindromic-substrings
73. Number of Longest Increasing https://leetcode.com/problems/number-of-longest-
Subsequence increasing-subsequence
https://leetcode.com/problems/partition-equal-subset-
Problems marked
74. Partition Equal Subset Sum sum
https://leetcode.com/problems/partition-to-k-equal-
75. Partition to K Equal Sum Subsets sum-subsets
76. Best Time to Buy and Sell Stock https://leetcode.com/problems/best-time-to-buy-and-
with Cooldown sell-stock-with-cooldown
77. Linked List Cycle II https://leetcode.com/problems/linked-list-cycle-ii
78. Add Two Numbers https://leetcode.com/problems/add-two-numbers
79. Remove Nth Node From End of List https://leetcode.com/problems/remove-nth-node-from-
end-of-list
80. Sort List https://leetcode.com/problems/sort-list
Patterns: Dynamic Programming, 2-pointers
WEEK 6
Problem Name Leetcode Link
81. Reorder List https://leetcode.com/problems/reorder-list
82. Clone Graph https://leetcode.com/problems/clone-graph
https://leetcode.com/problems/pacific-atlantic-water-
83. Paci c Atlantic Water Flow flow
84. Number of Islands https://leetcode.com/problems/number-of-islands
85. Graph Valid Tree https://leetcode.com/problems/graph-valid-tree
86. Number of Connected Components https://leetcode.com/problems/number-of-connected-
in an Undirected Graph components-in-an-undirected-graph
are compulsory and graded
87. Reverse Linked List II https://leetcode.com/problems/reverse-linked-list-ii
88. Rotate List https://leetcode.com/problems/rotate-list
Problems marked
89. Swap Nodes in Pairs https://leetcode.com/problems/swap-nodes-in-pairs
90. Odd Even Linked List https://leetcode.com/problems/odd-even-linked-list
91. Kth Smallest Element in a Sorted https://leetcode.com/problems/kth-smallest-element-in-
Matrix a-sorted-matrix
https://leetcode.com/problems/find-k-pairs-with-
92. Find K Pairs with Smallest Sums smallest-sums
93. Merge Intervals https://leetcode.com/problems/merge-intervals
94. Interval List Intersections https://leetcode.com/problems/interval-list-intersections
https://leetcode.com/problems/non-overlapping-
95. Non-overlapping Intervals intervals
Patterns: Linked List, 2-pointers, BFS, DFS and Graphs
fi
WEEK 7
Problem Name Leetcode Link
96. Meeting Rooms II https://leetcode.com/problems/meeting-rooms-ii
97. Task Scheduler https://leetcode.com/problems/task-scheduler
98. Minimum Number of Arrows to https://leetcode.com/problems/minimum-number-of-
Burst Balloons arrows-to-burst-balloons
99. Insert Interval https://leetcode.com/problems/insert-interval
100. Peak Index in a Mountain Array https://leetcode.com/problems/peak-index-in-a-
mountain-array
101. Find Minimum in Rotated Sorted https://leetcode.com/problems/find-minimum-in-
Array rotated-sorted-array
are compulsory and graded
102. Find Peak Element https://leetcode.com/problems/find-peak-element
103. Search in Rotated Sorted Array https://leetcode.com/problems/search-in-rotated-
sorted-array
https://leetcode.com/problems/search-in-rotated-
Problems marked
104. Search in Rotated Sorted Array II sorted-array-ii
105. Search a 2D Matrix https://leetcode.com/problems/search-a-2d-matrix
106. Search a 2D Matrix II https://leetcode.com/problems/search-a-2d-matrix-ii
107. Find K Closest Elements https://leetcode.com/problems/find-k-closest-elements
https://leetcode.com/problems/minimum-size-subarray-
108. Minimum Size Subarray Sum sum
109. Fruit Into Baskets https://leetcode.com/problems/fruit-into-baskets
110. Permutation in String https://leetcode.com/problems/permutation-in-string
Patterns: Binary Search, Intervals, and Sliding Window
WEEK 8
Problem Name Leetcode Link
111. Longest Repeating Character https://leetcode.com/problems/longest-repeating-
Replacement character-replacement
112. Longest Substring Without https://leetcode.com/problems/longest-substring-
Repeating Characters without-repeating-characters
https://leetcode.com/problems/kth-smallest-element-in-
113. Kth Smallest Element in a BST a-bst
https://leetcode.com/problems/k-closest-points-to-
114. K Closest Points to Origin origin
115. Top K Frequent Elements https://leetcode.com/problems/top-k-frequent-elements
https://leetcode.com/problems/sort-characters-by-
116. Sort Characters By Frequency frequency
are compulsory and graded
117. Kth Largest Element in an Array https://leetcode.com/problems/kth-largest-element-in-
an-array
118. Reorganize String https://leetcode.com/problems/reorganize-string
Problems marked
119. Course Schedule https://leetcode.com/problems/course-schedule
120. Course Schedule II https://leetcode.com/problems/course-schedule-ii
121. Minimum Height Trees https://leetcode.com/problems/minimum-height-trees
https://leetcode.com/problems/sequence-
122. Sequence Reconstruction reconstruction
123. Binary Tree Level Order Traversal https://leetcode.com/problems/binary-tree-level-order-
II traversal-ii
https://leetcode.com/problems/binary-tree-level-order-
124. Binary Tree Level Order Traversal traversal
125. Binary Tree Zigzag Level Order https://leetcode.com/problems/binary-tree-zigzag-level-
Traversal order-traversal
Patterns: BFS, DFS, Graphs, Topological Sort
WEEK 9
Problem Name Leetcode Link
126. Populating Next Right Pointers in https://leetcode.com/problems/populating-next-right-
Each Node pointers-in-each-node
127. Populating Next Right Pointers in https://leetcode.com/problems/populating-next-right-
Each Node II pointers-in-each-node-ii
https://leetcode.com/problems/binary-tree-right-side-
128. Binary Tree Right Side View view
129. All Nodes Distance K in Binary https://leetcode.com/problems/all-nodes-distance-k-in-
Tree binary-tree
130. Lowest Common Ancestor of a https://leetcode.com/problems/lowest-common-
Binary Search Tree ancestor-of-a-binary-search-tree
131. Path Sum II https://leetcode.com/problems/path-sum-ii
are compulsory and graded
132. Path Sum III https://leetcode.com/problems/path-sum-iii
133. Lowest Common Ancestor of a https://leetcode.com/problems/lowest-common-
Binary Tree ancestor-of-a-binary-tree
Problems marked
134. Maximum Binary Tree https://leetcode.com/problems/maximum-binary-tree
135. Maximum Width of Binary Tree https://leetcode.com/problems/maximum-width-of-
binary-tree
136. Construct Binary Tree from https://leetcode.com/problems/construct-binary-tree-
Preorder and Inorder Traversal from-preorder-and-inorder-traversal
https://leetcode.com/problems/validate-binary-search-
137. Validate Binary Search Tree tree
https://leetcode.com/problems/implement-trie-prefix-
138. Implement Trie (Pre x Tree) tree
139. 3Sum https://leetcode.com/problems/3sum
140. 3Sum Closest https://leetcode.com/problems/3sum-closest
Patterns: BFS, DFS, 2-pointers and Trie
fi
WEEK 10
Problem Name Leetcode Link
https://leetcode.com/problems/subarray-product-less-than-
141. Subarray Product Less Than K k
142. Sort Colors https://leetcode.com/problems/sort-colors
143. Container With Most Water https://leetcode.com/problems/container-with-most-water
144. Longest Word in Dictionary https://leetcode.com/problems/longest-word-in-dictionary
145. Maximum XOR of Two Numbers in https://leetcode.com/problems/maximum-xor-of-two-
an Array numbers-in-an-array
146. Factor Combinations https://leetcode.com/problems/factor-combinations
are compulsory and graded
147. Split a String Into the Max Number https://leetcode.com/problems/split-a-string-into-the-max-
of Unique Substrings number-of-unique-substrings
148. Maximum Number of Vowels in a https://leetcode.com/problems/maximum-number-of-
Substring of Given Length vowels-in-a-substring-of-given-length
Problems marked
149. Max Consecutive Ones III https://leetcode.com/problems/max-consecutive-ones-iii
150. Longest Subarray of 1's After https://leetcode.com/problems/longest-subarray-of-1s-
Deleting One Element after-deleting-one-element
151. First Missing Positive https://leetcode.com/problems/first-missing-positive
152. Sudoku Solver https://leetcode.com/problems/sudoku-solver
153. N-Queens https://leetcode.com/problems/n-queens
154. Reverse Nodes in k-Group https://leetcode.com/problems/reverse-nodes-in-k-group
155. Merge k Sorted Lists https://leetcode.com/problems/merge-k-sorted-lists
Patterns: Sliding window, 2-pointers, and backtracking
BONUS: HARD PROBLEMS
Problem Name Leetcode Link
Smallest Range Covering Elements from K https://leetcode.com/problems/smallest-range-covering-
Lists elements-from-k-lists
Employee Free Time https://leetcode.com/problems/employee-free-time
Count of Range Sum https://leetcode.com/problems/count-of-range-sum
Sliding Window Maximum https://leetcode.com/problems/sliding-window-maximum
Minimum Number of K Consecutive Bit https://leetcode.com/problems/minimum-number-of-k-
Flips consecutive-bit-flips
Count Unique Characters of All Substrings https://leetcode.com/problems/count-unique-characters-of-
of a Given String all-substrings-of-a-given-string
Minimum Window Substring https://leetcode.com/problems/minimum-window-substring
Substring with Concatenation of All https://leetcode.com/problems/substring-with-
Words concatenation-of-all-words
https://leetcode.com/problems/rearrange-string-k-distance-
Rearrange String k Distance Apart apart
Course Schedule III https://leetcode.com/problems/course-schedule-iii
Maximum Frequency Stack https://leetcode.com/problems/maximum-frequency-stack
Alien Dictionary https://leetcode.com/problems/alien-dictionary
https://leetcode.com/problems/binary-tree-maximum-path-
Binary Tree Maximum Path Sum sum
https://leetcode.com/problems/serialize-and-deserialize-
Serialize and Deserialize Binary Tree binary-tree
Word Search II https://leetcode.com/problems/word-search-ii
https://leetcode.com/problems/find-median-from-data-
Find Median from Data Stream stream
Sliding Window Median https://leetcode.com/problems/sliding-window-median
Trapping Rain Water https://leetcode.com/problems/trapping-rain-water
Concatenated Words https://leetcode.com/problems/concatenated-words
Pre x and Suf x Search https://leetcode.com/problems/prefix-and-suffix-search
Palindrome Pairs https://leetcode.com/problems/palindrome-pairs
https://leetcode.com/problems/design-search-
Design Search Autocomplete System autocomplete-system
Word Squares https://leetcode.com/problems/word-squares
Sort Items by Groups Respecting https://leetcode.com/problems/sort-items-by-groups-
Dependencies respecting-dependencies
https://leetcode.com/problems/median-of-two-sorted-
Median of Two Sorted Arrays arrays
fi
fi
REFERENCES
This is a growing list of references compiled from web
Binary Search
• https://leetcode.com/discuss/general-discussion/786126/python-powerful-ultimate-binary-search-
template-solved-many-problems
• Please clone this sheet for each batch. This would be graded list of problems for each week.
• https://docs.google.com/spreadsheets/d/1d-W6k6kGog5JJjkyIXpeB4SE_YA1GSkj_DTNdNUwa40/edit?usp=sharing