Lab Manual
Lab Manual
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
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
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
E VA L UAT I O N
Series Evaluation (SE) includes (but not limited to) Assignments, Quizzes, Class Participation and
Summative Test (ST) is conducted at the end of the semester to evaluate coding strengths, ability to
Final score is awarded for a total of 50 marks, with the nal score computed as follows
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
• 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.
• Problems with a in the title will be the graded ones for the nal assessment. Students are encouraged
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
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
https://leetcode.com/problems/maximum-depth-of-binary-
23. Maximum Depth of Binary Tree tree
are compulsory and graded
https://leetcode.com/problems/convert-1d-array-into-2d-
33. Convert 1D Array Into 2D Array array
https://leetcode.com/problems/maximum-average-
37. Maximum Average Subarray I subarray-i
https://leetcode.com/problems/find-all-duplicates-in-an-
40. Find All Duplicates in an Array array
https://leetcode.com/problems/longest-consecutive-
45. Longest Consecutive Sequence sequence
https://leetcode.com/problems/longest-increasing-
65. Longest Increasing Subsequence subsequence
https://leetcode.com/problems/longest-palindromic-
66. Longest Palindromic Substring substring
https://leetcode.com/problems/partition-equal-subset-
Problems marked
https://leetcode.com/problems/partition-to-k-equal-
75. Partition to K Equal Sum Subsets sum-subsets
https://leetcode.com/problems/pacific-atlantic-water-
83. Paci c Atlantic Water Flow flow
https://leetcode.com/problems/find-k-pairs-with-
92. Find K Pairs with Smallest Sums smallest-sums
https://leetcode.com/problems/non-overlapping-
95. Non-overlapping Intervals intervals
https://leetcode.com/problems/search-in-rotated-
Problems marked
https://leetcode.com/problems/minimum-size-subarray-
108. Minimum Size Subarray Sum sum
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
https://leetcode.com/problems/sort-characters-by-
116. Sort Characters By Frequency frequency
are compulsory and graded
https://leetcode.com/problems/sequence-
122. Sequence Reconstruction reconstruction
https://leetcode.com/problems/binary-tree-level-order-
124. Binary Tree Level Order Traversal traversal
https://leetcode.com/problems/binary-tree-right-side-
128. Binary Tree Right Side View view
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
https://leetcode.com/problems/subarray-product-less-than-
141. Subarray Product Less Than K k
https://leetcode.com/problems/rearrange-string-k-distance-
Rearrange String k Distance Apart apart
https://leetcode.com/problems/serialize-and-deserialize-
Serialize and Deserialize Binary Tree binary-tree
https://leetcode.com/problems/find-median-from-data-
Find Median from Data Stream stream
https://leetcode.com/problems/design-search-
Design Search Autocomplete System autocomplete-system
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