
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Stay consistent with the daily challenges, complete every day's target, follow the course order, solve questions on your own with 2x speed when needed, then check solutions using the tracker.
Learn what data structures are and why they matter for coding interviews, explore arrays and other common structures, and examine time and space efficiency with algorithms.
The lecture introduces complexity analysis, showing how time and space complexity reveal which solutions scale for large data. It covers time and space complexity, asymptotic analysis, and Big O notation.
Explore asymptotic analysis and big O notation to understand how time complexity grows with input size and compare common complexities like O(1), O(log n), O(n), and O(n^2).
Explore big o space complexity in data structures and algorithms, distinguishing auxiliary memory from input, and learn how constant and linear space trade off with time complexity.
Understand logarithms and their bases with examples like log 16 base 2 and log 8, and see how logarithmic time and space complexity emerge in algorithms such as binary search.
Analyze time and space complexity of array operations, including access, set, traverse, copy, insert, and remove, and contrast static and dynamic arrays with amortized end insertion.
Learn to write and run code in Chrome developer tools snippets and the RB Elide online editor, including a simple add function and console output.
Transform a sorted array of integers into a sorted array of their squares. Handle negatives, zeros, and duplicates, and discuss clarifying questions and test case ideas.
Square each element of a sorted array using brute force, then sort results to obtain a sorted output, with time complexity O(n log n) and space O(n).
Explore a brute force solution in JavaScript that squares each array element, sorts the results, and validates with test cases, while communicating clearly with the interviewer during the process.
Walk through a brute-force approach that builds a new array of squares, sorts it, and analyzes time complexity O(n log n) and space complexity O(n).
Analyze Python code for computing squared values of an array, producing a sorted result, and explore the big O analysis of time complexity O(n log n) and space complexity O(n).
Square the two ends of the sorted array and fill a new array from the end using a two-pointer method. Achieve O(n) time and O(n) space by exploiting the extremes.
Develop an optimal two-pointer algorithm to produce a sorted squared array from a given input, placing larger squares from the end of the new array and returning it.
The lecture walks through a JavaScript two-pointer algorithm using left and right pointers to compute a sorted squares array, then analyzes its time and space complexity as O(n).
Explore the Python code for the sorted squared problem using two pointers i and j, filling a new array from the end with the larger square at each step.
Explore monotonic arrays by identifying non decreasing and non increasing sequences, clarify edge cases, and craft test cases for coding interviews using Python and JavaScript.
Determine if an array is monotonic by evaluating non increasing and non decreasing cases via adjacent comparisons. Run the checks in O(n) time with constant space.
Identify the first and last elements, determine monotonicity by cases of equal ends, then scan for violations to ensure non-decreasing or non-increasing order, achieving O(n) time and O(1) space.
This lecture shows Python code to check if an array is monotonic by comparing first and last elements and scanning for increases or decreases, with linear time and constant space.
Practice right-rotating an array by k steps with examples, and emphasize clarifying questions and test cases for edge cases and rotation counts.
Rotate an array by k to the right using brute force and a modulo approach with a constant space reverse method, and analyze time and space complexity.
Demonstrates an in-place rotate algorithm for an array using a helper reverse function, detailing two-part reversal and swap steps, with O(n) time and O(1) space complexity.
Learn how to rotate an array to the right by k in Python, with a concrete example, edge-case handling, and a temp array approach achieving O(n) time and O(k) space.
Learn to rotate an array in Python in place using method 2, reversing segments to achieve right rotation with O(1) space and O(n) time.
Learn to identify two vertical lines in a height array that form a container with the x axis, maximizing the water area.
Explore method 1 brute force for the container with most water, computing the max area by checking pairs and deriving the time complexity as O(n^2) with constant space.
Implement a brute force solution for the max area problem by iterating pairs and calculating height as the minimum of two lines. Update the maximum area as you compare results.
Walk through a brute force solution to find the maximum area in an array, computing height and width, and analyze time complexity o(n^2) and space complexity o(1).
Learn a Python method to compute the maximum area by evaluating all index pairs with nested loops, taking the minimum of two values and multiplying by their index distance.
Use the two-pointer method to maximize the water area in an array, computing area as min(left, right) times width, and move the smaller pointer; achieves O(n) time and O(1) space.
Develop the optimum max area solution with a two-pointer approach on the array. Compute height as the minimum of the ends, update area, and move the smaller-height pointer.
Walk through a two-pointer solution that computes the max area using the minimum of two heights and their distance, with time complexity O(n) and space complexity O(1).
Use two pointers to reduce time complexity from quadratic to linear by moving the pointer at the smaller value and updating the max area.
Hash tables store key-value pairs and map keys to array indices with a hashing function, handling collisions via a linked list. Access, insert, and delete run in average constant time.
Interview Question 1
Clarifying Questions
Test Cases
Examine the brute force approach to finding a pair that adds up to the target value, using nested checks, and analyze its O(n^2) time and O(1) space.
Code the brute-force two-sum solution with nested loops to find two array elements that add to the target, returning their indices or an empty array, and verify with test cases.
Walks through a brute-force two-sum solution by checking pairs to find indices that sum to the target, and notes O(n^2) time with O(1) space.
Walks through a Python two-sum style solution using nested loops to check all pairs for a target, illustrating O(n^2) time and identifying indices 1 and 2.
Use a hash table to store values and indices, enabling constant-time lookups to find the needed value and return the indices that sum to the target in linear time.
Develop and implement a two-sum solution using a hash table to find two numbers that add up to the target. Return their indices or empty result when no pair exists.
Walk through an optimal hash-table solution to find a pair that adds to target, tracing a case, updating the hash table, and returning indices while explaining time and space complexity.
Write a Python solution that finds a pair of numbers adding to a target using a dictionary as a hash table, iterating once and returning the two indices.
Determine if two strings are isomorphic by mapping each character in the first string to a character in the second, ensuring one-to-one mappings.
Explains method and big O analysis for string isomorphy by comparing brute force O(n^2) and a linear-time hash map approach that checks length and mappings.
Learn to implement a check iso morphic function that decides if two strings are iso morphic using hash tables for forward and reverse mappings, with constant space and linear time.
Explore Python code for checking isomorphic strings using two dictionaries to map characters and ensure equal lengths. The approach yields linear time with constant space under ASCII constraints.
Explore the Fibonacci sequence and implement a function to compute f(n) for n >= 0, using a DP approach and exploring multiple solutions with time and space complexity notes.
Explore solving Fibonacci with recursion, tracing base cases and two recursive calls, and analyze exponential time and call-stack space; introduce dynamic programming as an optimization.
Master a recursive Fibonacci function with a base case n <= 1 returning n and a recursive step Fibonacci(n-1) + Fibonacci(n-2), verified by console tests up to eight.
Walk through a recursive fibonacci function by tracing f4, f3, f2, f1, and f0. Show time complexity O(2^n) and space complexity O(n) due to call stack depth.
learn a Python recursive fibonacci implementation with base cases n <= 1, compute f(n) by f(n-1) + f(n-2), and analyze its 2^n time and stack-based space usage.
Learn memorization in dynamic programming by storing fibonacci values in a hash table to avoid recomputation and analyze the resulting linear time complexity and hash table driven space usage.
Explore a memoized fibonacci implementation using a hash table to store computed values, showing F(n) = F(n-1) + F(n-2) with cache hits and O(n) time and space.
Learn to compute Fibonacci numbers efficiently using memoization in Python. Store intermediate results in a hash table to avoid recomputation, achieving linear time and space.
Learn an iterative Fibonacci calculation that tracks only two values, previous and current, with a next value to produce f(n). This approach yields time complexity O(n) and constant space O(1).
Implement an iterative fibonacci function in Python and JavaScript, using previous and current variables, a next value, and a while loop with a counter; test with sample inputs.
Explains the iterative fibonacci-like solution using previous, current, and next to compute the sequence up to n, in constant space and linear time.
Explains a Python function that computes the Fibonacci series using two variables and a loop, showing time complexity of the order of n and space complexity of one.
Master recursive data structure techniques by solving the power sum: convert nested arrays to equal values and sum, raising by depth to compute the total.
Use a recursive function to traverse nested arrays, sum integers, and raise each level's total to the corresponding power, then analyze time and space complexity.
Learn to implement a recursive power-sum function that traverses nested arrays, adds integers, and raises the accumulated sum by increasing powers with depth, validated by multiple examples.
Walk through a recursive solution that sums integers and nested arrays, applying a power parameter to subarrays, and review time and space complexity.
Walk through the Python power sum function, handling nested lists with recursion, summing non-list elements, and computing results with increasing power, while analyzing time and depth-based space complexity.
Explore permutations by listing all possible orderings of a distinct integer array, with examples for [1,2,3], [7,8], and edge cases—one element and empty arrays—plus interviewing tips and test case ideas.
Learn how to generate all permutations of an array using a swap-based backtracking method. Analyze the time and space complexity, including factorial growth and big-O implications.
Generate all permutations of an array using a recursive helper that swaps elements in place and records each complete order, as shown with 1, 2, 3.
Watch a recursive backtracking code walkthrough that generates all permutations by swapping array elements, exploring swaps via a helper function, and pushing each complete permutation to the results.
Walk through a Python recursive backtracking algorithm that generates all permutations by swapping elements with a helper function. Analyze the time and space complexity as factorial n.
Explore the powerset of a given array by generating all unique subsets, including the empty set, with no duplicates and in any order; test cases like [1,7] and [1,2,3] illustrate.
Explore generating all subsets (the power set) of an array with a recursive approach, compare with iterative construction, and analyze time and space complexity as two to the power n.
Implement a powerset by recursively exploring include and exclude branches, using a helper to build and copy subsets, then push them to output; illustrate with [1,2,3], yielding eight subsets.
Trace a depth-first recursive walk that builds all subsets of an array using a helper function and backtracking, collecting outputs and analyzing time and space complexity.
Explore a Python implementation of the power set using a recursive helper function, generating all subsets of a given array and analyzing time and space complexity.
Explore strings as data structures stored as arrays of integers, enabling constant-time index access and costs of append and concatenate in languages like C++, JavaScript, Python, and Java.
Learn to find the index of the first non repeating character in a mixed string of letters and digits, handle edge cases, case sensitivity, and design interview test cases.
Explore the brute force method for finding the first non-repeating character using two pointers, and analyze its O(n^2) time complexity and O(1) space, setting the stage for optimization.
Implement a brute-force function to find the first non-repeating character in a string using nested loops and a repeat flag, returning the index or null.
Walk through a brute force solution for a string-based question, tracing nested loops, character comparisons, and a repeat flag, and conclude with a quadratic time and constant space analysis.
Demonstrates a brute-force Python solution to find the first index with no duplicates by comparing all index pairs with nested loops, and analyzes its O(n^2) time and O(1) space.
Apply a hash table to optimize a string problem by counting character occurrences in a first pass and finding unique ones in a second pass, reducing brute-force O(n^2).
Discover how to find the first non repeating character by building a hash table of character counts and traversing the string again to return its index.
Follow a code walkthrough that builds a hash table to find the first non repeating character in a string, returning its index with O(n) time and constant space.
Python code finds the first non repeating character by counting with a dictionary and scanning for a count of one, using O(n) time and O(1) space.
Explore how to determine if a string is a palindrome, clarify edge cases in interviews, and design test cases for single-character inputs, empty inputs, and case sensitivity.
Explore three methods to check palindromes: reverse via string concatenation, build with an array and join, and a two-pointer comparison. The lecture includes Big O analysis of the first approach.
builds a palindrome check function that uses a for loop to traverse the string from end to start, builds a reversed string, and returns true or false with case sensitivity.
Build a reversed string by iterating from the end; note that in JavaScript, strings are immutable, so each append creates a string, yielding O(n^2) time and O(n) space.
Walk through a Python palindrome check that builds a reversed copy and compares it to the original, noting O(n^2) time and O(n) space.
Apply method 2 and Big O analysis to optimize string construction by using an empty array, pushing characters from the end, converting to a string, and comparing to given string.
Demonstrates a second palindrome check method by building a reversed string with an array, using push and join for comparison. Tests include a b c and uppercase E.
Walk through a code walkthrough that builds a reversed string by pushing chars from right to left and joining them to compare with original; note O(n) time and O(n) space.
Python code checks palindromes by building a reversed array of characters, appending each in reverse order, then joining to compare with the original string, in O(n) time and O(n) space.
Apply the two-pointer method from both ends to test palindrome, moving inward and comparing characters; this O(n) time, O(1) space solution is optimal among the three methods.
Implement the is palindrome check with two pointers from string ends, compare characters, and return false on mismatch; this runs in O(n) time and O(1) space.
Walk through a two-pointer string check on a sample input 'B.F. Eudy', comparing end characters and moving i and j until i exceeds j, with O(n) time and O(1) space.
Learn how a Python function checks if a string is a palindrome using two pointers, comparing characters and returning true or false with O(n) time and O(1) space.
Learn to determine the length of the longest substring without repeating characters in a string, with xyzxp, beep, and a r-to-w case; note to ask clarifying questions in interviews.
Learn to compare brute force substring enumeration with an efficient hash-table method that updates the start index to find longest substring with unique characters, and analyze time and space complexity.
Implement a maxlength function that traverses the string, uses a hash table to track indices, updates start on repeats, and returns the maximum length of a substring with unique characters.
Walk through a code walkthrough that explains how to find the longest substring with unique characters using a hash table and index tracking, with time and space complexity analysis.
This lecture shows a Python function to find the longest substring with unique characters using a seen dictionary and a moving start to skip duplicates.
Group anagrams from an array of lowercase strings by rearranging letters to use all original letters exactly once, and return the grouped anagrams in any order.
Group anagrams by sorting each string, map sorted forms with a hash table, and return grouped results, while analyzing time and space complexity in terms of input size.
Implement a group anagrams function that takes an array of strings, sorts each string's characters to form keys, builds a hash table, and returns grouped anagram arrays.
Explains how to group anagrams in python by sorting each string and using a hash table (dictionary) to collect and return the grouped results and analyzes time and space complexity.
Master binary search on sorted data, whether numbers or strings, using a divide-and-conquer approach to locate a target's index in log n time.
Understand how binary search finds a target in a sorted array by halving search space, computing the middle index, and adjusting left and right pointers with iterative and recursive implementations.
Implement iterative binary search on an integer array using left, right, and mid; compare to target, adjust bounds, and return index or -1, with O(log n) time and O(1) space.
Perform recursive binary search on an array of integers using a helper with left and right pointers, returning the target index or minus one.
Explore how to implement an iterative binary search in Python, using left and right pointers to find 87 in a sorted array with O(log n) time and O(1) space.
Master recursive binary search in Python, using a helper function with left and right pointers, mid calculations, and base-case checks to locate a target in a sorted array.
Explore searching in a rotated sorted array using a binary-search variation to find a target in log n time, handling rotation pivots and returning the index or -1.
Learn to search a rotated sorted array using a modified binary search that exploits the sorted half and yields O(log n) time.
Implement an iterative search in a rotated sorted array using left, right, and middle indices to identify sorted side and narrow the search with O(log n) time and O(1) space.
Implement an iterative Python function to search a target in a rotated array. Use binary search, identify sorted half, and return the index with log n time and constant space.
Learn to find the first and last indices of a target in a sorted non decreasing array using a binary search variation, achieving O(log n) time.
Explore a two-phase modified binary search to find the left and right extremes of a target in a sorted array, achieving logarithmic time with constant space.
Develop a recursive search to determine the left and right bounds of a target in an array. Analyze its logarithmic time and space complexity.
Learn python code to find the left and right extremes of a target in a non-decreasing array via recursive binary search, and analyze the time and space complexity.
Execute an iterative solution to find the target range in a sorted array by performing two modified binary searches for left and right extremes.
Discover an iterative Python solution to find the target range in a non-decreasing array using left and right extreme searches. This approach yields log n time and constant space.
Learn to search a matrix efficiently where each row is sorted left to right and each row's first element exceeds the previous row's last, returning true if the target exists.
Identify the target in a sorted matrix by locating the relevant row with binary search, then search that row, achieving O(log m + log n) time and O(1) space.
Identify the target's row via binary search, then perform a binary search on that row in the 2d matrix, achieving O(log m + log n) time and constant space.
Use two binary searches to locate a target in a sorted matrix: find the row, then search that row. Achieves log m + log n time with O(1) space.
Implement the bubble sort algorithm by repeatedly comparing adjacent elements, swapping when out of order, and performing passes until the array is sorted, illustrated with test cases.
Explore bubble sort, swapping adjacent elements to move the largest to the right in each pass, and analyze time complexity O(n^2) and space O(1).
Implement bubble sort in a function that repeatedly passes through an array, uses a sorted flag and a counter to stop early, swaps in place, and tests with example arrays.
Walk through a bubble sort on a sample array, showing how adjacent elements swap during each pass and how the algorithm achieves O(n^2) time with O(1) space.
Walk through a Python bubble sort implementation, tracing swaps, passes, and index operations on an array. Learn why the algorithm runs in O(n^2) time with O(1) space.
Learn insertion sort by building a sorted portion and inserting each element into its correct position, with best case O(n), worst and average case O(n^2), and constant space.
Learn to implement the insertion sort by moving elements between the sorted and unsorted parts, inserting at the correct position, and noting its quadratic time with constant space.
Learn Python code for insertion sort, inserting each unsorted element into the correct position in the sorted left part, using temp and index shifts; note O(n^2) time and O(1) space.
Explore how insertion sort functions as a stable sorting algorithm, demonstrated with the array 3, 1, 1, showing how equal elements preserve their initial relative order.
Student Testimonials:
"The teacher excels in explaining complex concepts clearly." - Liam Bailes
"I have just started but the quality of explanation is superb . I had seen many videos on time complexity but he explained very well."-Deepak Reddy
"So far, I am finding this course really helpful, and the trainer is really sorted about what he needs to teach and is completely prepared with his plan and material. I feel this is one of the best courses available in Udemy and outside to learn DSA because it is well structured and is delivering what we are looking for."-Ankur Saxena
"Great course. Lecturer is full of in depth knowledge and able to pass it on. Its not easy to find this out there. Thank you."-Mark Corrigan
"Because of this course I understand how to find complexity of the program. Teacher has explained concept in very easy manners, so that any body can understand it properly."-Amritesh Kumar Singh
"I really love the way you have explained it, and thanks for such a great course."- Soeng Kanel
"The course is a rare find for in-depth knowledge." - Mark Corrigan
"Well-structured and thorough preparation for DSA." - Ankur Saxena
"Easy to grasp concepts in a single go." - Shaik Asrar
"Effortless concept assimilation." - Elisha Benjamin
"A great foundation in DSA." - Prince Roy Sharma
"Simplifies understanding DSA." - Rahul
"Clarifies program complexity." - Amritesh Kumar Singh
"Clarified Big O notation for me." - Aaron Engelmann
"Excellent for problem-solving and reasoning." - Parth
"Comprehensive overview of Data Structures." - Newton
"Highly recommended for Tier 1 company preparation." - Dennis Paul
About the Course:
Welcome to the Coding Interview Bootcamp with a focus on Python and JavaScript!
The primary goal of this course is to prepare you for coding interviews at top tech companies. By tackling one problem at a time and understanding its solution, you'll accumulate a variety of tools and techniques for conquering any coding interview.
Daily Coding Challenges:
The course is structured around daily coding challenges. Consistent practice will equip you with the skills required for coding interviews and allow you to practice on Leetcode.
Topics Covered:
We start from the basics with Big O analysis, cover common data structures, and discuss real-life problems asked in interviews at tech giants like Google, Meta, Amazon, Netflix, Apple, and Microsoft.
For each question, we will:
Discuss the optimal approach
Explain time and space complexity
Code the solution in JavaScript (you can follow along in your preferred language)
Additional Resources:
The course includes downloadable resources, motivational trackers, and cheat sheets.
Course Outline:
Day 1: Arrays, Big O, Sorted Squared Array, Monotonic Array
Day 2: Arrays, Rotate Array, Container with Most Water
Day 3: Hash Tables, Two Sum, Isomorphic Strings
Day 4: Recursion, Fibonacci, Power Sum
Day 5: Recursion, Permutations, Power Set
Day 6: Strings, Non-Repeating Character, Palindrome
Day 7: Strings, Longest Unique Substring, Group Anagrams
Day 8: Searching, Binary Search, Search in Rotated Sorted Array
Day 9: Searching, Find First and Last Position, Search in 2D Array
Day 10: Sorting, Bubble Sort, Insertion Sort
Day 11: Sorting, Selection Sort, Merge Sort
Day 12: Sorting, Quick Sort, Radix Sort
Day 13: Singly Linked Lists, Construct SLL, Delete Duplicates
Day 14: Singly Linked Lists, Reverse SLL, Cycle Detection
Day 15: Singly Linked Lists, Find Duplicate, Add 2 Numbers
Day 16: Doubly Linked Lists, DLL Remove Insert, DLL Remove All
Day 17: Stacks, Construct Stack, Reverse Polish Notation
Day 18: Queues, Construct Queue, Implement Queue with Stack
Day 19: Binary Trees, Construct BST, Traversal Techniques
Day 20: Binary Trees, Level Order Traversal, Left/Right View
Day 21: Binary Trees, Invert Tree, Diameter of Tree
Day 22: Binary Trees, Convert Sorted Array to BST, Validate BST
Day 23: Heaps, Max Heap, Min Priority Queue
Day 24: Graphs, BFS, DFS
Day 25: Graphs, Number of Connected Components, Topological Sort
We offer a full money-back guarantee for 30 days. Enroll today!
Jackson