This course belongs to The code help and follows both our favorite mentors Love Babbar & Lakshay Kumar.
In this repository, you will get each and every class's notes in the form of a PDF and program with an explanation. Also, get the notes on the discord channel Console Busters as well as subscribe to the youtube channel Console Busters to watch our doubts and much more.
WEEKLY DOUBTS CLASSES
✅WEEK 06
DOUBT 01: Lower and upper bound for sorted array
DOUBT 02: Remove All Occurrences of a Substring (Leetcode-1910)
DOUBT 03: Majority Element (Leetcode-169)
WEEK 01 TOPIC: Introduction to programming
CLASS NOTES: 01
1. How to approach a problem
2. What is pseudocode and flowchart
CLASS HOMEWORK: 01
1. Examples of pseudocode and flowchart
WEEK 01 TOPIC: Write your first C++ program
CLASS NOTES: 02
1. Why do we need programming language
2. How compiler and interpreter work
3. Where to code
4. Lets write down the first code
5. Print Love Babbar
6. Variables and data types
7. How data is stored
8. Signed and unsigned data
9. Operators in C++
CLASS HOMEWORK: 02
1. 32 bits VS 64 bit architecture
2. Typecasting: implicit and explicit
3. Number system: binary to decimal
WEEK 01 TOPIC: Conditionals and loops
CLASS NOTES: 03
1. Conditional statements
2. Loop statements
Pattern 1: Square pattern
Pattern 2: Rectangle pattern
Pattern 3: Hollow Rectangle pattern
Pattern 4: Half Pyramid pattern
Pattern 5: Inverted Half Pyramid pattern
Pattern 6: Numeric Half Pyramid pattern
Pattern 7: Inverted Numeric Half Pyramid pattern
CLASS HOMEWORK: 03
0. All flowcharts are converted into CPP programs
1. Multiply two numbers by taking input from user
2. Find the perimeter of a triangle
3. Find the simple interest
4. Find the compound interest
5. Print counting from n to 1
6. Find the factorial of a number
7. Check if number is prime or not
8. Check valid triangle or not
9. Print max of three numbers
WEEK 02 TOPIC: Pattern continues
CLASS NOTES: 04
Pattern 08: Full Pyramid
Pattern 09: Inverted Full Pyramid
Pattern 10: Dimond Pattern
Pattern 11: Hollow Full Pyramid
Pattern 12: Inverted Hollow Full Pyramid
Pattern 13: Hollow Diamond pattern
Pattern 14: Flipped Solid Diamond pattern
Pattern 15: Fancy pattern 1
Pattern 17: Inverted Hollow Half Pyramid
Pattern 19: Fancy pattern 4
CLASS HOMEWORK: 04
Pattern 16: Fancy pattern 2
Pattern 18: Fancy pattern 3 -> Numerical Hollow Half Pyramid
Pattern 20: Numeric Hollow Inverted Half Pyramid
Pattern 21: Numeric Palindrome Equilateral Pyramid
Pattern 22: Fancy pattern 5
Pattern 23: Solid Half Diamond
Pattern 24: Floyd Triangle
Pattern 25: Butterfly Pattern
WEEK 02 TOPIC: Bitwise operators and loops
CLASS NOTES: 05
1. Bitwise operators
2. Left and right shift operators
3. Pre/post increment and decrement operators
4. Break and continue keyword
5. Variable scoping
6. Operator precedence table
CLASS HOMEWORK: 05
1. All homework programs
2. Why global variables are bad practice
WEEK 02 TOPIC: Functions
CLASS NOTES: 06
1. What is function
2. Function call stack
3. Write a function to print sum of 3 numbers
4. Write a function to return sum of 3 numbers
5. Find maximum of three numbers
6. Counting from 1 to N
7. Check prime or not prime number
8. Check number is even or odd
9. Sum of all numbers upto 1 to N
10. Sum of all even numbers upto 1 to N
CLASS HOMEWORK: 06
1. Function to find area of circle
2. Function to find factorial of a number
3. Print all prime numbers from 1 to N
4. Print all digits of an integer
5. Creating a number using digits
6. Print binary representation of a decimal number
7. Convert KM into Miles
8. Convert farenheit to celcius
9. Count all set bits of a number
10. Check even/odd using bitwise operator
WEEK 03 TOPIC: Arrays - Level 1
CLASS NOTES: 07
1. What is array
2. Why do we need of array
3. Create an array
4. Symbol table
5. Address operator and sizeof operator
6. Array initialization
7. Bad practice with array size
8. Array indexing
9. Access elements of array
10. Taking input in an array
11. Meaning of arr[i] (FORMULA)
12. Updating array with example
13. Linear search in an array
14. Array and function
15. Programs
a.) Count 0's and 1's in an array
b.) Minimum and maximum number in an array
c.) Reverse an array (Two pointer approach)
d.) Extreme print an array
CLASS HOMEWORK: 07
1. No homework
WEEK 03 TOPIC: Arrays - Level 2
CLASS NOTES: 08
1. Function pass by value
2. Function pass by reference
3. Array and function (pass by reference)
4. Program 01: Find unique element
5. Program 02: Print all pairs
6. Program 03: Print all triplets
7. Program 04: Sort 0's and 1's
8. Introduction to time and space complexity
CLASS HOMEWORK: 08
1. Program 05: Shift array's element by one (Right to left)
2. Program 06: Shift array's element by two (Right to left)
3. HW 01: Shift array's element by one (Left to right)
WEEK 03 TOPIC: Arrays - Level 3
CLASS NOTES: 09
1. 2D-Array
2. Create 2D-Array
3. Initialize 2D-Array
4. Access 2D-Array's elements
5. How 2D-Array stored in memory
6. Print 2D-Array row wise
7. Print 2D-Array column wise
8. Taking input from user in 2D-Array
9. Linear Search in 2D-Array
10. Maximum and Minimum in 2D-Array
11. Print row wise and column wise sum of 2D-Array
12. Sum of principal diagonal elements of a matrix
13. Transpose of a matrix
14. Vector Notes
15. Jagged Array
CLASS HOMEWORK: 09
1. Column wise sum of a 2D-Array
2. Sum of secondary diagonal elements
WEEK 03 TOPIC: Arrays - Extra Class
CLASS NOTES: 10
1. Moving All Negative Number to the Left Side of an Array
2. Sort Colors (Leetcode-75)
3. Rotate Array (Leetcode-189)
4. Missing Number (Leetcode-268)
5. Row with maximum ones (VVIimp Leetcode-2643)
6. Rotate Image by 90 degree (VVImp Leetcode-48)
CLASS HOMEWORK: 10
1. Re-arrange array elements (Leetcode-2149)
2. Find Pivot Index (Leetcode-724)
3. Find Duplicate Number (Leetcode-287)
4. Missing Element From An Array With Duplicates (GFG)
5. Find First Repeating Element (GFG)
6. Common Element in 3 Sorted Array (GFG)
7. Wave Print A Matrix (GFG)
8. Spiral Print A Matrix (Leetcode-54)
9. Factorial of A Large Number (GFG)
10. Key Pair/Two Sum (GFG and Leetcode-1)
11. Remove Duplicates From Sorted Array (Leetcode-26)
12. Maximum Average Subarray 1 (Leetcode-643)
13. Find Pivot Index with prefix sum approach (Leetcode-724)
14. Missing Number with XOR operator (Leetcode-268)
15. Add two numbers represented by two array (GFG Solved before Q.No. 9)
WEEK 04 TOPIC: Searching and Sorting - Level 1
CLASS NOTES: 11
1. Linear search
2. Binary search (MONOTONIC ARRAY)
3. Time complexity of binary search
4. Rules of binary search
5. Find first occurrence of a number in sorted array
6. Find last occurrence of a number in sorted array
7. Find total occurrence of a number in sorted array
8. Find missing element in sorted array (GFG)
9. Peak element/index in a mountain array (Leetcode-852)
CLASS HOMEWORK: 11
1. Find pivot element (LeftSum equals to RightSum)(Leetcode-724)
WEEK 04 TOPIC: Searching and Sorting - Level 2
CLASS NOTES: 12
1. Find pivot element index from sorted and rotated array
2. Search in a rotated and sorted array (Leetcode-33)
3. Sqrt of X (Leetcode-69)
4. Binary search in 2D array (Leetcode-74)
CLASS HOMEWORK: 12
1. Find sqrt of X upto N decimal place
WEEK 04 TOPIC: Searching and Sorting - Level 3
CLASS NOTES: 13
1. Divide two number using Binary search without using any / and % operator
2. Binary search on nearly sorted array
3. Find the Number Occurring Odd Number of Times (Leetcode-540)
CLASS HOMEWORK: 13
1. K-Diff Pairs in An Array (Leetcode-532)
2. Find K-Closest Element (Leetcode-658)
3. Exponential Search (Concept)
4. Unbounded Binary Search (Concept)
5. Book Allocation Problem (GFG & Code studio)
6. Painters Partition Problem (GFG & Code studio)
7. Aggressive Cows (GFG & Code studio)
8. EKO SPOJ
9. PRATA SPOJ
10. Find SQRT of Integer N using Binary Search with K point decimal precision.
11. Divide using Binary Search with K point decimal precision.
12. Majority Element (Leetcode-169)
✅SORTINGS
1. BUBBLE SORT
2. SELECTION SORT
3. INSERTION SORT
✅CUTOM COMPARATOR
1. SORT A VECTOR
2. SORT VECTOR OF VECTOR
WEEK 05 TOPIC: Char Arrays and Strings - Level 1
CLASS NOTES: 14
✅CHAR ARRAYS
1. What is char array
2. ASCII CHARACTER CODE 256
3. Char array creation
4. Taking input in char array
5. Print and access char array
6. Null char ASCII CODE
7. Delimiter concept
8. cin.getline(p1,p2) method
9. Program 01: Length of string
10. Program 02: Reverse string
11. Program 03: Uppercase to lowercase and vice versa
12. Program 04: Replace @ with the white space
13. Program 05: Check palindrome
✅STRINGS
14. What is string?
15. Creation of string
16. Taking input in string
17. Print string and access string by index
18. getline(cin,name) method
19. Char array Vs string
20. Important predefined function of string
-> Method 01:
-> Method 02:
-> Method 03:
-> Method 04:
-> Method 05:
-> Method 06:
-> Method 07:
-> Method 08:
-> Method 09:
-> Method 10:
CLASS HOMEWORK: 14
1. ASCII CHARACTER CODE 256
2. Explore build in method from CPLUSHCPLUSH.COM
WEEK 05 TOPIC: Char Arrays and Strings - Level 2
CLASS NOTES: 15
1. Remove All Adjacent Duplicates In String (Leetcode-1047)
2. Remove All Occurrences of a Substring (Leetcode-1910)
3. Valid Palindrome II (Leetcode-680)
4. Palindromic Substrings (Leetcode-647)
CLASS HOMEWORK: 15
1. Remove All Adjacent Duplicates in String II (Leetcode-1209)
2. Minimum Time Difference (Leetcode-539)
WEEK 05 TOPIC: Char Arrays and Strings - Level 3
CLASS NOTES: 16
1. Decode the Message (Leetcode-2325)
2. Minimum Amount of Time to Collect Garbage (Leetcode-2391)
3. Custom Sort String (Leetcode-791)
4. Find and Replace Pattern (Leetcode-890)
CLASS HOMEWORK: 16
1. Valid Anagram (Leetcode-245)
2. Reverse Only Letters (Leetcode-917)
3. Longest Common Prefix (Leetcode-14)
4. Reverse Vowels of a String (Leetcode-345)
5. Isomorphic Strings (Leetcode-205)
6. Group Anagrams (Leetcode-49)
7. Reorganise String
8. Longest Palindromic Substring
9. Find the Index of the First Occurrence in a String
10. String to Integer (atoi)
11. String Compression
12. Integer to Roman
13. Zig-zag Conversion
14. Largest Number
15. Remove All Adjacent Duplicates in String II (Leetcode-1209)
16. Implement std::string::erase()
17. Minimum Time Difference (Leetcode-539)
18. Number of Laser Beams in a Bank (Leetcode-2125)
WEEK 06 TOPIC: Basic Maths & Pointers - Level 1
CLASS NOTES: 17
1. What is pointer
2. Address operator
3. Creation of pointers
4. Access pointer and dereference operator
5. Declaration of pointer (5 Practice Questions)
6. Pointer with array (4 Practice Questions)
7. Char array and pointer (4 Practice Questions)
CLASS HOMEWORK: 17
1. Why pointer size was coming 8 while printing
2. why we can not do [arr = arr + 1;] in C++
3. Wild pointer in C++
4. Void pointer in C++
5. Dangling pointer in C++
6. Pointers imporatant doubt
BASIC MATHEMATICS FOR DSA
PROGRAM 01: Count primes (Leetcode-204)
APPROACH 01: Naive
APPROACH 02: SQRT
APPROACH 03: Sieve of Eratosthenes
APPROACH 04: Segmented sieve
PROGRAM 02: Find GCD/HCF using Euclids Algorithm (GFG)
PROGRAM 03: Find LCM (GFG)
CONCEPT 01: Modulo Arithmetic
PROGRAM 04: Fast exponentiation (GFG)
APPROACH 01: Naive solution
APPROACH 02: Better solution
PROGRAM 05: Modular Exponentiation for large numbers (GFG)
PROGRAM 06: Optimising Sieve of Eratosthenes
PROGRAM 07: Segmented Sieve (GFG)
PROGRAM 08: HW🔗Product of primes (GFG)
WEEK 06 TOPIC: Basic Maths & Pointers - Level 2
CLASS NOTES: 18
1. Array of pointer
2. Pointer to an array
3. Pointer with functions
4. Pointer to pointer (3 Practice Questions)
5. Pass by value
6. Pass by reference
7. MCQs on pointers practice
WEEK 07 TOPIC: Recursion - Level 1
CLASS NOTES: 19
1. Bookish definition of recursion
2. Love Bhaiyas definition of recursion
3. Recursion mandatory terms
4. Factorial of n number
5. How recursion work and function call stack
6. Why base case important (Due to Stack Overflow)
7. Reverse counting from n to 1
8. Tail and head recursion
9. Pow(2,N)
10. Recursive tree
11. Fibonacci series
12. Return sum from n to 1
CLASS HOMEWORK: 19
1. Time and space complexity of recursion
WEEK 07 TOPIC: Recursion - Level 2
CLASS NOTES: 20
1. Climbing stairs (Leetcode-70)
2. Print array
3. Search in array
4. Minimum in array
5. Arrays even elements stored in vector
6. Double each element
7. Find in Array
8. Print index of all occurrence of target
9. Return vector with all occurrences of target
10. Print the digits of the number
CLASS HOMEWORK: 20
1. Print the Fibonacci series using an iterative method
2. Maximum in an array
3. Print number of digits
4. Find target in string and print it's target indices
WEEK 07 TOPIC: Recursion - Level 3
CLASS NOTES: 21
1. Check array sorted or not
2. Binary search recursive solution
3. Pattern 01: Include and exclude pattern
✅Problem: Subsequence of string
4. Pattern 02: Exploring all possible ways pattern
✅Problem: Maximize the cost segment (GFG)
5. Coin change (Leetcode-322)
6. House Robber (Leetcode-198)
CLASS HOMEWORK: 21
1. Last occurrence of a char
2. Reverse a String
3. Add Two Strings (Integer stored as String)
4. Palindrome Check
5. Print all Subarray
6. Remove all Occurrence of a Substring
7. Buy and sell stocks
8. House Robbery problem
9. Integer to English words
10. Wild Card Matching
11. Perfect Square
12. Minimum Cost for Tickets
13. Number of Dice Roll with Target Sum
WEEK 08 TOPIC: Backtracking & Divide and conquer - Class 01
CLASS NOTES: 22
1. Divide and conquer algorithm
2. Merge sort
3. Merge two sorted array
4. Stack and heap memory
5. Time complexity of merge sort
6. Quick sort algorithm
CLASS HOMEWORK: 22
1. Space complexity of merge sort
2. Inversion count in Array using Merge Sort
WEEK 08 TOPIC: Backtracking & Divide and conquer - Class 02
CLASS NOTES: 23
1. What is backtracking?
2. Permutation of string
3. Rat in a maze
CLASS HOMEWORK: 23
1. Count inversion
2. In-place merge sort
3. Maximum Subarray
4. Combination sum problem
5. Combination sum problem - II
6. Permutation - II
7. Beautiful Arrangement
8. Distribute Repeating Integers
WEEK 08 TOPIC: Recursion marathon - Extra class
CLASS NOTES: 24
1. Maximum sum of nod - adjacent element - House Robber (Leetcode-198)
2. House Robber II (Leetcode-213)
3. Count Derangements (GFG)
4. Painting Fence Algorithm (GFG)
5. Edit distance (Leetcode-72)
6. Maximal Square (Leetcode-221)
CLASS HOMEWORK: 24
1. 0/1 Knapsack Problem (GFG)
2. Minimum Score Triangulation of Polygon (Leetcode-1039)
3. Number of Dice Rolls With Target Sum (Leetcode-1155)
WEEK 09 TOPIC: Object Oriented Programming - Class 01
CLASS NOTES: 25
1. Local and global variable
2. Memory layout of a program
3. Functional programming
4. Object oriented programming
5. Class
6. Object
7. Access modifiers
8. Constructor
9. Polymorphism
10. This pointer
11. Stack and Heap memory allocation
(Static and Dynamic Allocation of memory)
12. Padding concept
CLASS HOMEWORK: 25
1. Const keyword
2. Default argument
3. Initialization list
4. MACROS
5. Static keyword in class
- How does class work
- Static data members
- Static member function
WEEK 09 TOPIC: Object Oriented Programming - Class 02
CLASS NOTES: 26
1. Copy constructor
2. Life cycle of an object
3. Destructor
4. Getter and setter method
5. Abstraction (One Pillar of OOPS)
5.1. Encapsulation
5.1.1 Perfect encapsulation
5.2 Inheritance
5.2.1 Mode of inheritance table
5.2.2 Type of inheritance
5.2.2.1 Single inheritance
5.2.2.2 Multilevel inheritance
5.2.2.3 Hierarchical inheritance
5.2.2.4 Multiple inheritance
5.2.2.5 Diamond Problem (Hybrid inheritance)
5.2.2.5.1 Sol 01: Scope resolution
5.2.2.5.2 Sol 02: Using virtual
5.3 Polymorphism
5.3.1 Static/compile time polymorphism
5.3.1.1 Function overloading
5.3.1.2 Constructor overloading
5.3.1.3 Operator overloading
5.3.1 Run time polymorphism
CLASS HOMEWORK: 26
1. Shallow vs deep copy
2. Can constructor be made private
3. Friend keyword in C++
WEEK 09 TOPIC: Object Oriented Programming - Class 03
CLASS NOTES: 27
1. Run time polymorphism
CLASS HOMEWORK: 27
1. Virtual CTOR vs virtual DTOR
2. Abstraction in C++
3. Inline function
WEEK 10 TOPIC: Linked List - Class 01
CLASS NOTES: 28
1. What is a node?
2. What is a linked list?
3. Why use of linked list?
4. Types of linked list
5. Create a linked list and a node
6. Print linked list
7. Print the length of the linked list "Number of nodes"
8. Insertion operations of SLL
- Print linked list
- Find length of linked list
- Insert node at the head
- Insert node at the tail
- Insert at any position
9. Create a tail
CLASS HOMEWORK: 28
1. Insert at any position with the help of only one pointer "PREVIOUS"
WEEK 10 TOPIC: Linked List - Class 02
CLASS NOTES: 29
1. Deletion operations of SLL
- Delete a node from the head
- Delete a node from the tail
- Delete a node from any position
2. Double linked list
- Print linked list
- Find length of linked list
- Insert node at the head
- Insert node at the tail
- Insert at any position
3. Deletion operations of DLL
- Delete a node from the head
- Delete a node from the tail
- Delete a node from any position
CLASS HOMEWORK: 29
1. Circular linked list
WEEK 10 TOPIC: Linked List - Class 03
CLASS NOTES: 30
1. Reverse Linked List (Leetcode-206)
- Approach 1: Iterative approach
- Approach 2: Recursive approach
2. Middle of the Linked List (Leetcode-876)
- Approach 1: getLength and getMid
- Approach 2: Slow and fast pointer "Hare & Tortoise" algorithm
- Reasoning : Why this algorithm work
3. Palindrome Linked List (Leetcode-234)
- Approach 1: Optimal
- Approach 2: Brute force
4. Linked List Cycle (Leetcode-141)
- Approach 1: Using STL map
WEEK 10 TOPIC: Linked List - Class 04
CLASS NOTES: 31
1. Linked List Cycle (Leetcode-141)
- Approach 1: Fast and slow algorithm
- Reasoning : Why this algorithm work
2. Starting point of loop (Leetcode-142)
- Approach 1: Fast and slow algorithm
- Reasoning : Why this algorithm work
3. Remove loop (GFG)
- Approach 1: Fast and slow algorithm
4. Add 1 to a linked list (GFG)
5. Reverse Nodes in k-Group (Leetcode-25)
- Approach 1: Recursive approach
6. Remove Duplicates from Sorted List (Leetcode-83)
CLASS HOMEWORK: 31
1. Merge Two Sorted Lists (Leetcode-21)
2. Sort Lists using Merge Sort (Leetcode-148)
3. Intersection of Two Linked Lists (Leetcode-160)
4. Delete N Nodes after M Nodes (GFG)
5. Print kth Node from the End (Hackerrank)
6. Flatten Linked List (GFG)
7. Copy List with Random Pointer (Leetcode-138)
8. Rotate List (Leetcode-61)
9. Odd Even Linked List (Leetcode-328)
10. Find Minimum and Maximum Number of Nodes Between Critical Points (Leetcode-2048)
11. Merge Nodes in between Zeros (Leetcode-2181)
12. Add two linked list (Leetcode-442)
13. Sort 0, 1, 2 in linked list (GFG)
14. ARTICLE: Quick Sort Algorithm is best for array or linked list?
15. ARTICLE: Merge Sort Algorithm is best for array or linked list?
16. Double a number represented as a linked list
17. Swapping nodes in a linked list
18. Remove zero sum consecutive nodes from linked list
WEEK 11 TOPIC: Stack - Class 01
CLASS NOTES: 32
1. What is stack?
2. Stack implementation using dynamic array
- push() method
- pop() method
- isEmpty() method
- getTop() method
- getSize() method
- Important corner cases: overflow and underflow
3. Problem 1: Reverse string using stack
4. Problem 2: Middle element of a stack
- Approach 1: Recursion and backtracking
5. Problem 3: Insert at bottom of a stack
- Approach 1: Recursion and backtracking
6. Problem 4: Reverse a stack
- Approach 1: Recursion and backtracking
7. Problem 5: Insert in a sorted stack
- Approach 1: Recursion and backtracking
8. Problem 6: Sort a stack
- Approach 1: Recursion and backtracking
WEEK 11 TOPIC: Stack - Class 02
CLASS NOTES: 33
1. Problem 1: Implementation of Two Stack in an Array
2. Problem 2: Valid Parentheses (Leetcode-20)
3. Problem 3: Remove Redundant Brackets
WEEK 11 TOPIC: Stack - Class 03
CLASS NOTES: 34
Problem 1: Implement a minStack (Leetcode-155)
Problem 2: Next smaller element
Problem 3: Prev smaller element
Problem 4: Largest Rectangle Area in Histogram (Leectcode-84)
CLASS HOMEWORK: 34
1. Minimum Bracket Reversal
2. Remove All Adjacent Duplicates In String
3. Celebrity Problem
4. Next greater element in Linked List (Leetcode)
5. N Stacks in an Array
6. Online Stock Span (Leetcode)
7. Check If Word Is Valid After Substitutions (Leetcode)
8. Decode Strings (Leetcode)
9. Car Fleet I (Leetcode)
10. Car Fleet - II (Leetcode)
11. Simplify Path (Leetcode)
12. Max rectangle in Binary Matrix with all 1s
13. Daily Temperatures
14. Remove K Digits
15. Minimum Add To Make Parentheses Valid
16. Longest Valid Parentheses
17. Asteroid Collision
18. Design Browser History
19. Final Prices With a Special Discount in a Shop (Leetcode-1475)
WEEK 12 TOPIC: Queue - Class 01
CLASS NOTES: 35
1. What is Queue and STL Queue
2. Queue Implementation using a Dynamic Array
3. Circular Queue Implementation
4. Circular Doble Ended Queue Implementation
WEEK 12 TOPIC: Queue - Class 02
CLASS NOTES: 36
1. Reverse a queue
2. Reverse 'k' element in a queue ⭐
3. Interleave first and second half of a queue
4. First negative integer in every window of 'k' ⭐
WEEK 12 TOPIC: Queue - Class 03
CLASS NOTES: 37
1. First Non Repeating/Unique Character in a String (Leetcode-387)
2. Gas Station (Leetcode-134)
3. Sliding Window Maximum (Leetcode-239)
HOMEWORK NOTES: 37
1. Implement Queue using Stack
2. Implement Stacks using Queue
3. Implement "K" queues in an array
4. Sum of min/max element of all subarray of size "k"
5. Number of Recent Calls
6. First Unique Character in a String
7. Number of People Aware of a Secret
8. Maximum Sum Circular Subarray
9. Find the Winner of the Circular Game
10. Reveal Cards In Increasing Order
11. Product of the Last K Numbers
12. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
13. Delivering Boxes from Storage to Ports
WEEK 13 TOPIC: Binary Tree - Class 01
CLASS NOTES: 38
1. What is a binary tree
2. Terms of binary tree
3. Implementation of binary tree
4. Three binary tree traversals
I. Pre-order traversal
II. In order traversal
III. Post order traversal
5. Level order traversal in a line
6. Level order traversal in level wise
7. Height of a binary tree (Leetcode-104)
8. Diameter of binary tree (Leetcode-543)
HOMEWORK NOTES: 38
1. Generics tree
2. READ ARTICLE: Skew tree
3. READ ARTICLE: BFS and DFS Algorithm
4. READ ARTICLE: Complete and perfect binary tree
WEEK 13 TOPIC: Binary Tree - Class 02
CLASS NOTES: 39
1. Balanced Binary Tree (Leetcode-110)
2. Lowest Common Ancestor of a Binary Tree (Leetcode-236)
3. Path Sum (Leetcode-112)
4. Path Sum II (Leetcode-113)
5. K-th ancestor of a node in Binary Tree (GFG)
6. Construct Binary Tree from Inorder and Preorder Traversal (Leetcode-105)
7. Construct Binary Tree from Inorder and Postorder Traversal (Leetcode-106)
HOMEWORK NOTES: 39
1. K-th ancestor of a node in Binary Tree (GFG)
WEEK 13 TOPIC: Binary Tree - Class 03
CLASS NOTES: 40
1. Left view of binary tree
2. Right view of binary tree
3. Top view of binary tree
4. Bottom view of binary tree
5. Boundary traversal of binary tree
HOMEWORK NOTES: 40
1. FW to find diameter of binary tree
2. FW to find height balanced tree
3. Check two trees are identical
4. Symmetric Tree (Mirror Subtrees)
5. Zig-zag traversal
6. Transform to sum tree
7. Diagonal Traversal
8. Vertical Traversal
9. K-Sum Paths
10. Morris Traversal
11. Flatten a binary tree into LinkedList
12. Sum of longest bloodline of tree
13. Maximum sum of non-adjacent nodes
14. Burning Tree
15. Find Duplicate Sumtrees
16. Left view of binary tree using level order traversal
WEEK 14 TOPIC: Binary Search Tree - Class 01
CLASS NOTES: 41
1. What is binary search tree
2. Create binary search tree
3. Traversals of binary search tree
4. Min and Max value in BST
5. Target value present or not in BST
6. Delete node from BST
WEEK 14 TOPIC: Binary Search Tree - Class 02
CLASS NOTES: 42
1. Construct BST from Inorder (GFG)
2. Validate BST (Leetcode-98)
3. Lowest Common Ancestor of a BST (Leetcode-235)
4. Kth Smallest Element in a BST (Leetcode-230)
5. Two Sum IV - Input is a BST (Leetcode-653)
WEEK 14 TOPIC: Binary Search Tree - Class 03
CLASS NOTES: 43
1. Convert BST into Sorted Double Linked List (IMP-QUESTION-INTERVIEW)
2. Convert Sorted Double Linked List into BST (IMP-QUESTION-INTERVIEW)
HOMEWORK NOTES: 43
1. Inorder Successor in BST
2. Inorder Predecessor in BST
3. Build BST using Preorder Traversal
4. Brothers from Different roots
5. Convert BST to a Balanced BST
6. Find the Median of BST
7. Check BST has Dead End
8. Count BST Nodes lying in a Range
9. Flatten BST to Sorted LL
10. Replace elements with the least Greater elements to it Right
11. Valid BST from Preorder
12. Merge two BSTs
WEEK 15 TOPIC: Heap - Class 01
CLASS NOTES: 44
1. What is heap?
2. Min and Max heap
3. Insertion to heap
4. Deletion from heap
5. Heapify using recursion
6. Convert array to heap
7. Heap sort
WEEK 15 TOPIC: Heap - Class 02
CLASS NOTES: 45
1. C++ STL Priority Queue "MAX HEAP"
2. C++ STL Priority Queue "MIN HEAP"
3. Kth Smallest Element in an Array using Max Heap (GFG)
4. Kth Largest Element in an Array using Min Heap (GFG)
5. Check if a given Complete Binary Tree is a Max Heap or not? (GFG)
6. Check Whether a Binary Tree is a Complete Binary Tree or Not? (Leetcode-958)
7. Convert Given Combination of CBT and BST into a Valid Max Heap (GFG)
WEEK 15 TOPIC: Heap - Class 03
CLASS NOTES: 46
1. Merge K Sorted Arrays (GFG)
2. Merge K Sorted Linked Lists (Leetcode-23)
3. Smallest Range in K Lists (Leetcode-632)
WEEK 15 TOPIC: Heap - Class 04
CLASS NOTES: 47
1. Remove Stones to Minimize the Total (Leetcode-1962)
2. Reorganize String (Leetcode-767)
3. Longest Happy String (Leetcode-1405)
4. Median in a Stream (CodingNinjas)
HOMEWORK NOTES: 47
1. Check If Binary Tree is Heap
2. Merge Two Binary Max Heap
3. K-Closest points to the origin
4. Get Biggest Three Rhombus Sums In A Grid
5. Minimum Difference in Sums After Removal of Elements
6. Minimum Number of Refueling Stops
7. Sliding Window Maximum
WEEK 16 TOPIC: Hashmaps & Tries - Class 01
CLASS NOTES: 48
1. What is Maps?
2. C++ STL Maps Type
3. Implement C++ STL Unordered Map
4. Hash Function
- Hash Code
- Compression Function
- Collision
- Handle Collision Techniques
a. Open Hashing
b. Closed addressing
I. Linear Probing
II. Quadratic Probing
- How and Why the Time Complexity of Insertion, Deletion, and Searching is O(1)
- Load Factor
5. Basic problems on maps
PROBLEM 1: Store all character frequency of a string
PROBLEM 2: Reorganize String (Leetcode-767)
PROBLEM 3: Linked List Cycle (Leetcode-141)
WEEK 16 TOPIC: Hashmaps & Tries - Class 02
CLASS NOTES: 49
1. What is Trie?
2. How to organize the data in trie?
3. Create Trie Node
4. Insertion Method of Trie
5. Searching Method of Trie
6. Deletion Method of Trie
HOMEWORK NOTES: 49
1. Print All Words of Given Prefix String
WEEK 16 TOPIC: Hashmaps & Tries - Class 03
CLASS NOTES: 50
1. Print All Words of Given Prefix String - I
2. Print All Words of Given Prefix String - II
3. Longest Common Prefix (Leetcode-14)
HOMEWORK NOTES: 50
1. Array Subset of Another Array
2. Union of Two Linked Lists
3. Intersection of Two Linked Lists
4. Sum Equals To Sum
5. Largest Subarray with 0 Sum
6. Largest Subarray of 0’s and 1’s
7. Valid Anagram
8. Replace Words
9. Top K Frequent Words
10. Camelcase Matching
11. Palindrome Pairs
WEEK 17 TOPIC: Dynamic Programming - Class 01
CLASS NOTES: 51
1. What is Dynamic Programming?
2. Where to Use Dynamic Programming?
3. Three Approach for DP
I. Top Down Approach (Memoization)
II. Bottom-up Approach (Tabulation)
III. Patterns Approach (Space Optimization)
4. Fibonacci (Leetcode-509)
5. Cut Segment (GFG)
6. What is 1DP and 2DP?
WEEK 17 TOPIC: Dynamic Programming - Class 02
CLASS NOTES: 52
1. House Robber (Leetcode-198)
2. Coin Change (Leetcode-322)
WEEK 17 TOPIC: Dynamic Programming - Class 03
CLASS NOTES: 53
1. Painting Fence Algorithm (GFG)
2. 0/1 Knapsack Problem (GFG)
WEEK 17 TOPIC: Dynamic Programming - Class 04
CLASS NOTES: 54
1. Longest Common Subsequence (Leetcode-1143)
2. Longest Palindrome Subsequence (Leetcode-516)
3. Edit Distance (Leetcode-72)
WEEK 18 TOPIC: Dynamic Programming - Class 05
CLASS NOTES: 55
1. Longest Increasing Subsequence (Leetcode-300)
2. Maximum Height by Stacking Cuboids (Leetcode-1691)
3. Russian Doll Envelopes (Leetcode-354)
4. Longest Common Subsequence (Leetcode-1143)
WEEK 18 TOPIC: Dynamic Programming - Class 06
CLASS NOTES: 56
1. Guess Number Higher or Lower II (Leetcode-375)
2. Minimum Cost Tree From Leaf Values (Leetcode-1130)
WEEK 18 TOPIC: Dynamic Programming - Class 07
CLASS NOTES: 57
1. Partition Equal Subset Sum (Leetcode-416)
2. Number of Dice Rolls With Target Sum (Leetcode-1155)
WEEK 18 TOPIC: Dynamic Programming - Assignments
CLASS ASSIGNMENTS:
1. Perfect Squares (Leetcode-279)
2. Minimum Cost for Tickets (Leetcode-983)
3. Minimum ASCII Delete Sum for 2 Strings Leetcode
4. Longest Palindromic SubString Leetcode
5. Distinct Subsequences Leetcode
6. Word Break Leetcode
7. Word Break-2 Leetcode
8. Unique BST-2 Leetcode
9. House Robber-3 Leetcode
10. Unique BST-2 Leetcode
11. Stone Game
12. Stone Game-2
13. Stone Game-3
14. Burst balloons Leetcode
15. Interleaving Strings Leetcode
16. Minimum Insertion Steps to Make a String Palindrome
17. Russian Doll Envelopes Leetcode
18. Minimum Number of Removals to Make Mountain Array
19. Make Array Strictly Increasing
20. Best Time To Buy & Sell Stock - Already Taught in Recursion Week
21. Best Time To Buy & Sell Stock-2
22. Best Time To Buy & Sell Stock-3
23. Best Time To Buy & Sell Stock-4
24. Best Time To Buy & Sell Stock-5
25. Target Sum Leetcode
26. Ones and Zeroes Leetcode
27. Minimum Swaps To Make Sequences Increasing
28. Reducing Dishes Leetcode
29. Predict the Winner Leetcode
WEEK 19 TOPIC: Graphs - Class 01
CLASS NOTES: 58
1. What is a Graph?
2. Terminologies of a graph
- Directed and undirected graph
- Edge list
- Unweighted edge and weighted edge
- Unweighted graph and weighted graph
- Cyclic graph and acyclic graph
- Degree
- Indegree and outdegree
- Path: valid and invalid path
- Components (disconnected and connected graph)
3. Interview Based Question
- Practical use of graph
- Is each graph a tree?
- Is each tree a graph?
- Clone a graph
4. Graph Creation
- Using Adjacency Matrix
- Using Adjacency List
- Generalize the code of the graph creation
- HW: Time and space complexity of graph creation?
5. Traverse the graph
- BFS Algorithm
- HW: Time and space complexity of BFS?
- DFS Algorithm
- HW: Time and space complexity of DFS?
- HW: Find the number of components of a graph.
WEEK 19 TOPIC: Graphs - Class 02
CLASS NOTES: 59
1. Detect cycle in an undirected graph using BFS (GFG)
2. Detect cycle in an undirected graph using DFS (GFG)
3. Detect cycle in an directed graph using DFS (GFG)
WEEK 19 TOPIC: Graphs - Class 03
CLASS NOTES: 60
1. Topological Sorting with DFS
2. Topological Sorting with BFS
3. Detect cycle in a directed graph using BFS
4. Shortest path in an undirected graph using BFS
WEEK 19 TOPIC: Graphs - Class 04
CLASS NOTES: 61
1. Shortest path in a weighted directed graph using DFS (SSSP Algorithms)
2. Shortest path in a weighted undirected graph using Dijkstra Algorithm
WEEK 20 TOPIC: Graphs - Class 05
CLASS NOTES: 62
1. Course Schedule (Leetcode-207)
2. Course Schedule II (Leetcode-210)
3. Path With Minimum Effort (Leetcode-1631)
WEEK 20 TOPIC: Graphs - Class 06
CLASS NOTES: 63
1. Number of Provinces (Leetcode-547)
2. Number of Islands (Leetcode-200)
3. Flood Fill (Leetcode-733)
4. Rotting Oranges (Leetcode-994)
WEEK 20 TOPIC: Graphs - Class 07
CLASS NOTES: 64
1. Dijkstra Algorithm
2. Bellman Ford Algorithm
3. Floyd Warshall Algorithm
4. Kosaraju Algorithm
5. Tarjans Algorithm for Bridges (Leetcode-1192)
WEEK 20 TOPIC: Graphs - Assignments
CLASS ASSIGNMENTS:
1. Prim’s Algorithm for MST
2. Kruskals Algorithm for MST
3. Eventual Safe States
4. Word Ladder-2
5. Minimum Multiplications to reach End
6. Number of Operations to Make Network Connected
7. Find the City With the Smallest Number of Neighbors at a Threshold Distance
8. Accounts Merge
WEEK 21 TOPIC: Bit Manipulation
CLASS NOTES: 65
1. Bitwise operators
2. Check even or odd number
3. Get Ith bit from right side
4. Set Ith bit from right side
5. Clear Ith bit from right side
6. Update Ith bit from right side
7. Single number (Leetcode-136)
8. Clear n bits from last
9. Check power of two
10. Count set bits
11. Clear bits in range
12. Subsequence of a string "Include & Exclude" (Leetcode-78)
13. Pow(x, n) (Leetcode-50)
- Naive Approach
- Fast Exponentiation
- Binary Exponentiation
14. Single number II (Leetcode-137)
15. Single number III (Leetcode-260)
16. Binary to decimal
17. Decimal to binary
18. Count total jump from source to destination
WEEK 21 TOPIC: Sliding Window Technique
CLASS NOTES: 66
1. Sliding window varients
2. Fixed size window
- Sliding Window Maximum (Leetcode-239)
- Max Sum Subarray of size K (GFG)
3. Variable size window
- Minimum Size Subarray Sum (Leetcode-209)
- Binary Subarrays With Sum (Leetcode-930)
4. Two pointer approach
- Two Sum (Leetcode-1)
5. Optimization approach
- Minimum Window Substring (Leetcode-76)
6. Master sliding window through this resource
Resource 1: https://leetcode.com/discuss/general-discussion/1122776/summary-of-sliding-window-patterns-for-subarray-substring
Resource 2: https://leetcode.com/discuss/interview-question/3722472/mastering-sliding-window-technique-a-comprehensive-guide