Blueprint to solve questions using Backtracking
Course Content
0 / 482 completedIntroduction to Data Structures
Big O Space Complexity
Asymptotic Analysis and Big O
Introduction to Big O, Time Complexity
What you're going to get from this course
Big O Logarithm
Welcome! How to make best use of this course (Please Watch)
Arrays Data Structures Crash Course
CODING INTERVIEW Q1 (Easy) Sorted Squared Array
Method 1, Big O Analysis
JS Code - Method 1
JavaScript Code - Method 2
Method 2
CODING INTERVIEW Q2 (Easy) Monotonic Array
Method and Big O analysis
JavaScript Code - Monotonic Array
Celebrating Milestones
Recursion Basics
Recursive Leap of Faith
Recursion vs Iteration
Ways to write Base condition
Visualising Recursion
Recurrence relation
How to Solve Recursion Questions
Recursion is everywhere
Complexity Analysis of Recursive Solutions
Recursion Approaches - 0 to N and N to 0
CODING INTERVIEW QUESTION (Medium) k-th symbol in Grammar
Approach(k-th symbol in Grammar)
Pseudocode (k-th symbol in Grammar)
Complexity Analysis(k-th symbol in Grammar)
JavaScript Solution (k-th symbol in Grammar)
Pseudocode
Complexity Analysis
Approach 1
JavaScript Solution 1 Josephus problem Method 1
CODING INTERVIEW QUESTION (Medium) Josephus problem
Approach 2
Pseudocode
JavaScript Solution 2 Josephus problem Method 2
Complexity Analysis
Approach 3
Complexity Analysis
JavaScript Solution 3 Josephus problem Method 3
Celebrating Milestones
Identifying that wew can use Recursion
CODING INTERVIEW QUESTION (Medium) Tower of Hanoi
Approach
Recursion Tree
JavaScript Solution Tower of Hanoi
CODING INTERVIEW QUESTION(Medium) Power Sum
JavaScript Solution Power Sum
Method and Big O Analysis
Celebrating Milestones
Complexity Analysis Tower of Hanoi
What is Backtracking
How is it different from Recursion
How does Backtracking work
Pass by reference change inplace
Identify when to use Backtracking
Blueprint to solve questions using Backtracking
CODING INTERVIEW QUESTION (Medium) Permutations
JavaScript Solution Permutations
Approach
Pseudocode
CODING INTERVIEW QUESTION(Medium) Permutations 2
Complexity Analysis
Approach
Pseudocode
JavaScript Code Permutations 2
Complexity Analysis Permutations 2
Celebrating Milestones
CODING INTERVIEW QUESTION(Medium) Subsets
Subsets - Comparison with Backtracking Blueprint
Method
Subsets - Complexity Analysis
CODING INTERVIEW QUESTION(Medium) Subsets 2
JavaScript Code - Subsets
code walkthrough (optional)
Subsets 2 Complexity Analysis
JavaScript Code Subsets 2
Celebrating Milestones
CODING INTERVIEW QUESTION(Medium) Combinations
Approach
Combinations Complexity Analysis
JavaScript Code Combinations
JavaScript Code Combinations with Optimisation
Combinations Optimisation
CODING INTERVIEW QUESTION ( Medium) Combinations Sum 1
Sidenote Max number of nodes
Complexity Analysis part 1
Complexity Analysis part 2
Celebrating Milestones
JavaScript Code Combinations Sum 1
CODING INTERVIEW QUESTION (Medium) Combinations Sum 2
Complexity Analysis
JavaScript Code Combination Sum 2
Celebrating Milestones
CODING INTERVIEW QUESTION(Hard) Sudoku Solver
isValid check for Sudoku Solver
Pseudocode
CODING INTERVIEW QUESTION(Hard) N Queen
Complexity Analysis
JavaScript Code Sudoku Solver
Approach
Pseudocode
Complexity Analysis
JavaScript Code N Queen
Dynamic Programming - Patterns
Introduction to Dynamic Programming (DP)
Why writing the Recursive solution helps to write the Bottom up approach
Identifying Dynamic Programming Questions
Approach to solve DP(Dynamic Programming) Questions
CODING INTERVIEW QUESTION(Easy) Fibonacci
Approaches
Approach 1 Recursion
JavaScript Code - Recursion
Complexity Analysis Approach 1 - Recursion
Approach 2 Memoization
Complexity Analysis Approach 2 - Memoization
JavaScript Code Approach 2 - Memoization
Approach 3 Tabulation
Complexity Analysis Approach 3 - Tabulation
JavaScript Code Approach 3 - Tabulation
Approach 4 Space Optimised Tabulation + Complexity Analysis
CODING INTERVIEW QUESTION(Easy) Climbing Stairs
JavaScript Code Approach 4 -Space Optimised Tabulation + Complexity Analysis
Approach
CODING INTERVIEW QUESTION(Easy) Min Cost Climbing Stairs
Recursive Approach
JavaScript Code Recursive Approach
Memoization Approach
JavaScript Code Memoization Approach
Tabulation Approach
JavaScript Code Tabulation Approach
Complexity Analysis
CODING INTERVIEW QUESTION(Medium) 01 Knapsack
Recursive Approach Pseudocode
Recursive Approach Complexity Analysis
Approach 1 Recursion
JavaScript Code Recursive Approach
Memoization Pseudocode
JavaScript Code Memoization
Approach 2 Memoization
Memoization Complexity Analysis
JavaScript Code Tabulation
JavaScript Code Space Optimised Tabulation
Tabulation Complexity Analysis
Approach 4 Space Optimised Tabulation Approach
Space Optimised Tabulation Approach Complexity Analysis
Approach 3 Tabulation
CODING INTERVIEW QUESTION(Medium) Unbounded Knapsack
Complexity Analysis
Tabulation Approach
JavaScript Code Unbounded Knapsack
CODING INTERVIEW QUESTION(Medium) LCS
JavaScript Code LCS
Recursion Tree and Complexity Analysis
Tabulation Complexity Analysis
JavaScript Code Tabulation - LCS
JavaScript Code Memoization - LCS
Approach 4 Space Optimised Tabulation - LCS
JavaScript Code Space Optimised Tabulation - LCS
Approach 3 Tabulation
Identifying this as an LCS Type Question
CODING INTERVIEW QUESTION(Medium) Edit Distance
Pseudocode
Recursion Complexity Analysis
Approach 1 Recursion
JavaScript Code Recursive Approach(Edit Distance)
Approach 2 Memoization
Tabulation Complexity Analysis
JavaScript Code Memoization(Edit Distance)
JavaScript Code Tabulation (Edit Distance)
Approach 4 Space Optimised Tabulation
Approach 3 Tabulation
JavaScript Code Space Optimised Tabulation ( Edit Distance)
CODING INTERVIEW QUESTION(Medium) Longest Increasing Subsequence (LIS)
Approach 1 Recursion - LIS
Complexity Analysis - Recursion - LIS
JavaScript Code - Recursion - LIS
Complexity Analysis - Memoization
Recursion Tree
JavaScript Code - Memoization - LIS
Complexity Analysis - Tabulation - using a 2D dp array
Approach 3 Tabulation - using a 2D dp array
Dry run
JavaScript Code - Tabulation using a 2D dp array - LIS
Approach 4 Tabulation - using a 1D dp array
Complexity Analysis- Tabulation - using a 1D dp array
Dry run
Approach 5 using Binary Search - LIS
JavaScript Code-Tabulation - using a 1D dp array
Part 1 - Approach 5 using Binary Search - LIS
Part 2 - Approach 5 using Binary Search - LIS
Binary Search for this question ( refer Binary Search section for more details)
Complexity Analysis - Approach 5 using Binary Search - LIS
Why Sort
CODING INTERVIEW QUESTION(Medium) Max Length of Pair Chain
JavaScript Code - Approach 5 using Binary Search - LIS
Approach
JavaScript Code - Max Length of Pair Chain
Approach
Complexity Analysis
CODING INTERVIEW QUESTION(Hard) Russian Doll Envelopes
JavaScript Code
Introduction to Gap Strategy or Length wise Iteration
CODING INTERVIEW QUESTION(Medium) Palindromic Substrings
Approach Recursion with memoization
Intuition for Approach
Idetifying this as a DP question
pseudocode
Filling the Memoization table
iterate length wise
Recursion with memoization Complexity analysis
Tabulation approach Complexity Analysis
JavaScript Code Recursion with memoization
Tabulation approach
JavaScript Code Tabulation
Approach (Tabulation)
CODING INTERVIEW QUESTION(Medium) Longest Palindromic Substring
Complexity Analysis
JavaScript Code
CODING INTERVIEW QUESTION(Medium) Longest Palindromic Subsequence
Complexity Analysis
JavaScript Code
Approach
Introduction to the Partition method
CODING INTERVIEW QUESTION(Medium) Palindrome Partitioning
Side note Computing n C r
Pseudocode
CODING INTERVIEW QUESTION(Hard)Palindrome Partitioning 2 ( Minimum Cuts) - Hard
JavaScript Code Palindrome Partitioning
Approach 1 Recursion
JavaScript Code Memoization - Palindrome Partitioning 2
JavaScript Code Recursion - Palindrome Partitioning 2
Tabulation - Approach A Palindrome Partitioning 2
JavaScript Code Tabulation - Approach A Palindrome Partitioning 2
Complexity Analysis
Dry Run
Dry run
Tabulation - Approach B Palindrome Partitioning 2
Pseudocode
JavaScript Code Tabulation - Approach A Palindrome Partitioning 2
CODING INTERVIEW QUESTION(Medium) Word Break
Approaches
Approach 1 Tabulation
Complexity Analysis
JavaScript Code
APPROACH 2 Part A Memoization
JavaScript Code - Recursion
JavaScript Code- Memoization
Pseudocode
APPROACH 2 Part B Tabulation
Complexity Analysis
CODING INTERVIEW QUESTION(Hard) Matrix Chain Multiplication
Pseudocode
JavaScript Code
How to do Matrix Multiplication
Back to the Question
Intuition
Pseudocode
Approach
JavaScript Code - Greedy Approach
CODING INTERVIEW QUESTION Task Scheduler
JavaScript Code
Coding Interview Q1(Medium) Rotate Array
Method and Big O analysis
JavaScript Code Solution
Coding Interview Q2(Medium) Container with most water
JavaScript Code Method 1
Code walkthrough and Big O analysis
Method 1 and Big O analysis
JavaScript Code Method 2
Method 2 and Big O analysis
Code walkthrough
Coding Interview Q1(Easy) Two Sum
Method 1, Big O analysis
Hash Table Data Structures Crash Course
Code Walkthrough
JavaScript Code
Method 2, Big O analysis
Coding Interview Q2(Easy) Isomorphic Strings
Code Walkthrough
Method and Big O analysis
JavaScript Code
Introduction to 2 Pointer Pattern
CODING INTERVIEW QUESTION Best Time to Buy and Sell Stock
Code
CODING INTERVIEW QUESTION Two Sum 2
Complexity Analysis
Method
Code
CODING INTERVIEW QUESTION 3 Sum
Complexity Analysis
Method 1
Code - Method 1
Method 2
Code
Introduction to Sliding Window Pattern
CODING INTERVIEW QUESTION Max Avg Subarray I
JS Code
CODING INTERVIEW QUESTION Repeated DNA Sequence
Test cases
Method 1
JS Code Method 1
(Optional) Basics - Converting a number from base 4 to base 10
Method 2
JS Code Method 2
CODING INTERVIEW QUESTION Sliding Window Maximum
Test Cases
SideNote Deque data structure
Method - Part 1 ( Intuition Observations)
Method - Part 2 (Walkthrough)
CODING INTERVIEW QUESTION Minimum Window Substring
JS Code
Test Cases
CODING INTERVIEW QUESTION Min Size Subarray Sum
Method
Walkthrough
JS Code
Method
CODING INTERVIEW QUESTION Frequency of most frequent element
JS Code
JS Code
Method - Part 2 ( Walkthrough)
Method - Part 1
Data Structures Crash Course Strings
Coding Interview Q1(Easy) First Non Repeating Character
JavaScript code
Method 1 and Big O analysis
Code walkthrough
Method 2 and Big O analysis
JavaScript code
Code walkthrough
Coding Interview Q2(Easy) Is Palindrome
JavaScript code
Method 1 and Big O analysis
Code walkthrough
Method 2 and Big O analysis
JavaScript code
Code walkthrough
Method 3 and Big O analysis
JavaScript code
Code walkthrough
Coding Interview Q1(Medium) Longest Sub string with Unique characters
Coding Interview Q2(Medium) Group Anagrams
JavaScript code
Code walkthrough
method and Big O analysis
JavaScript code
Coding Interview Q1 (Easy) Binary Search Algorithm
JavaScript Code Iterative
Coding Interview Q2(Medium) Search in rotated sorted array
JavaScript Code Recursive
JavaScript Code
Method and Big O analysis
Coding Interview Q1(Medium) Search for range
Coding Interview Q2(Medium) Search in Matrix
JavaScript Code - Iterative
JavaScript Code - Recursive
Coding Interview Q1 Bubble Sort Algorithm
JavaScript Code
Code Walkthrough
Coding Interview Q2 Insertion Sort Algorithm, Big O analysis
Insertion sort is a stable sorting Algorithm
Python code
Coding Interview Q1 Selection Sort Algorithm, Big O analysis
Coding Interview Q2 Merge Sort Algorithm
JavaScript Code
JS Code Walkthrough
Method and Big O analysis
Coding Interview Q1 Quick Sort Algorithm
Optimise Time Complexity
JS Code walkthrough
Optimise Space Complexity
Call stack walkthrough
Coding Interview Q2 Radix Sort Algorithm, Big O analysis
JavaScript Code
CODING INTERVIEW QUESTION Merge Intervals
Introduction to Merge Intervals Coding Interview Question Pattern
Complexity Analysis
Method - Part 2 (Walkthrough)
Method - Part 1
JS Code
Complexity Analysis
CODING INTERVIEW QUESTION Insert Interval
Method - Part 1
Method - Part 2 (Walkthrough)
JS Code
CODING INTERVIEW QUESTION Non Overlapping Intervals
Method Part 3 - Why Greedy
Method Part 2 - Walkthrough
Method Part 1
Data Structures Crash Course Linked Lists
Coding Interview Q2 Remove Duplicates
Coding Interview Q1(Medium) Design a Singly Linked List
Javascript Code walkthrough
Method and Big O analysis
Coding Interview Q1(Easy) Reverse
Coding Interview Q2(Medium) Cycle Detection
Javascript Code walkthrough
Proof
Coding Interview Q1(Medium) Find duplicate number
method and Big O analysis
Coding Interview Q2(Medium) Add 2 numbers
method and Big O analysis
Coding Interview Q1 Remove Node, Insert Node
Method remove
Insert Intro
walkthrough remove
JavaScript code Remove
Method Insert
Remove Val Method
Insert at Position
Coding Interview Q2 Remove Value, Insert at Position in Doubly Linked List
JavaScript code Insert
method
Walkthrough Insert
JavaScript Code
Coding Interview Q1 Design a Stack
Data Structures Crash Course Stacks and Queues
Coding Interview Q2(Medium) Reverse Polish Notation
Coding Interview Q1 Design a Queue
Coding Interview Q2(Easy) Queue with Stack
method and Big O analysis
Data Structures Crash Course Trees Introduction
What is a BST - Binary Search Tree
Proof height of Balanced Binary tree is floor(log N)
Theory Binary Tree Terminaologies
Theory Binary Trees 1
Coding Interview Q1 Construct Binary Search Tree,Big O analysis
Javascript Code Walkthrough
Coding Interview Q2 Traverse - BFS and DFS,Big O analysis
Javascript Code Walkthrough
CODING INTERVIEW QUESTION Pre order Traversal of Binary Tree Iterative
JavaScript Code Preorder Traversal Iterative
CODING INTERVIEW QUESTION Inorder Traversal of Binary Tree - Iterative
Approach
JavaScript Code - Inorder Traversal of Binary Tree
CODING INTERVIEW QUESTION Post order traversal of Binary Tree - Iterative
JavaScript Code - Postorder Traversal of Binary Tree
CODING INTERVIEW QUESTION Path Sum 2
Coding Interview Q1(Medium) Level Order traversal
Insert method
Coding Interview Q2(Medium) Left Right view
Level Order Traversal Method and Big O analysis
Method and Big O analysis
JavaScript code
JavaScript code - Level order traversal
Iterative method and Big O analysis
Coding Interview Q1 (Easy) Invert Binary Tree
JavaScript Code Iterative
Recursive method and Big O analysis
Coding Interview Q2 (Easy) Diameter of Binary Tree
Method and Big O analysis
Coding Interview Q1(Easy) sorted array to BST
method and Big O analysis
Coding Interview Q2(Medium) Valid BST
JavaScript code
Method and Big O analysis
JavaScript Code
Binary Heap Data Structure Crash Course
Proof of Build Binary Heap Time Complexity
Coding Interview Q1 Construct Max Binary Heap, Big O analysis
Introduction to Priority Queue
Coding Interview Q2 Construct Priority Queue,Big O analysis
Data Structures Crash Course Graphs Introduction
Coding Interview Q1 BFS, Adjacency List,Big O analysis
Data Structures Crash Course Graphs - Part 2
Data Structures Crash Course Graphs - Part 3
BFS, Adjacency Matrix
Coding Interview Q2 DFS, Recursive, Big O analysis
DFS Iterative
JavaScript Code
Coding Interview Q2(Medium) Course Scheduler
Coding Interview Q1 Number of Components, Big O analysis
JavaScript Code
Brute Force Method and Big O analysis
Big O - Brute Force Method
JavaScript Code - Brute Force Method
Topological Sort based method and Big O analysis