
We examine the container with the most water problem by treating the array as vertical lines and picking two walls to maximize area. Area equals width times the minimum height.
Apply a straightforward brute force method to maximize water area by enumerating all pairs of walls, computing area as the minimum height times width, and tracking the largest result.
Explore the brute force pseudocode for forming containers, track max area with two walls, compute length, width, and area, and note O(n^2) time with constant space.
Apply the two-pointer technique to optimize the container with the most water problem, moving the pointer at the smaller wall to maximize area and reduce time complexity.
Master a two-pointer approach for the container with most water, using left and right pointers to compute area. Evaluate time and space as O(n) time and O(1) space.
Implement a two-pointer solution in C++ to maximize the container area by updating max area with min(height[L], height[R])*(R-L) and moving the smaller height pointer until left and right pointers meet.
Analyze the valid mountain array problem by checking a strictly increasing prefix followed by a strictly decreasing suffix. Use arrays of integers and length at least three to decide validity.
Identify an increasing subsequence followed by a decreasing subsequence by scanning with a loop, track where the increasing part ends, and ensure the sequence extends to the array end.
Walk through pseudocode that checks for a mountain array by scanning an increasing subsequence then a decreasing subsequence. The solution runs in O(n) time with O(1) space.
Learn to implement the valid mountain array function. Traverse uphill to a peak, then descend, returning true if the full array is covered and false otherwise.
Explore the boats to save people problem by pairing weights under a limit to minimize the number of boats, with at most two per boat, illustrated through examples and constraints.
Learn to solve a two-pointer boat pairing problem by sorting weights and pairing the heaviest with the lightest to maximize two-person boats under the limit.
Walk through a pseudocode guided two-pointer greedy solution to boat problem: sort weights, pair heaviest with lightest within the limit, count boats, with O(n log n) time and O(n) space.
Sort the array in ascending order, then use two pointers to pair the lightest and heaviest within the limit; if not possible, ship the heaviest alone and count a boat.
Move zeros to the end while preserving the relative order of non-zero elements, then explore a brute-force approach using an auxiliary array and zero padding.
Explore a brute force approach that builds an output array of non-zero elements in order, then appends zeros, with linear time and O(n) space.
Use an in-place two-pointer approach to move non-zero elements to the front, tracking count with j and scanning with I, then fill the rest with zeros.
This walkthrough shows an optimal two-pass solution for the move zeros problem: move nonzero elements forward with index j, then fill positions with zeros, achieving O(n+m) time and O(1) space.
implement the move zeros function to relocate non-zero elements to the front of the array, preserving their order, and fill the remainder with zeros in place, with no extra space.
Explore the longest substring without repeating characters, including why substrings must be contiguous and how examples illustrate edge cases. Preview a simple brute-force approach.
Explore a brute force approach to find the longest substring without repeating characters by checking all substrings, using a map to track seen characters, and updating the maximum length.
Walk through the pseudocode to learn a brute-force method for the longest substring without repeating characters, then apply sliding window optimization with left and right pointers and a seen map.
Explore the sliding window approach to find the longest substring without repeating characters using two pointers and a map of last seen indices, with a smart left-pointer update.
Walk through pseudocode using left and right boundaries (L and R) and a seen characters map to track the longest substring in a window, with O(N) time and O(N) space.
Implement a function that returns the length of the longest unique substring using a sliding window and a hash map, updating left and right pointers and answer as you traverse.
Locate the first and last positions of a target in a sorted ascending array using brute force; scan left for the first occurrence and right for the last.
Explore a brute force pseudocode walkthrough that uses forward and backward scans to locate first and last indices of a target in an array, with O(n) time and O(1) space.
Use binary search on a sorted array with left and right pointers to find the first and last positions of a target, replacing brute force with an optimal solution.
Follow a pseudocode walkthrough of binary search to find the first and last occurrence of a target in a sorted array, using two pointers, left, right, and mid.
Walk through the pseudocode using two pointers to find the last occurrence of the target in a sorted array with binary search, achieving O(log n) time and O(1) space.
Learn to locate the first and last occurrences of a target in a sorted array using binary search, with precise boundary checks and returning [first, last] indices.
Explore the first bad version problem through a brute force linear search using isBadVersion to locate the first bad version, with O(N) time and O(1) space.
Use binary search with isBadVersion to locate the first bad version by halving the range until the first bad version is identified.
Master the first bad version problem with a binary search walkthrough using an isBadVersion API, two pointers, and mid calculations to achieve O(log n) time and O(1) space.
Learn to locate the first bad version using binary search by querying isBadVersion on mid, updating left and right bounds, and ensuring the earliest bad version is returned.
Explore the missing number problem. Given n distinct numbers from zero to n, identify the one number not present, with concrete examples and edge-case discussions.
Explore the brute force approach to find the missing number in a range by sorting the input and inspecting consecutive elements to detect a gap, then return the missing value.
Present a better approach to find the missing number from 0 to n in a distinct array by using a hash map for constant-time lookups, achieving O(n) time.
Use a present numbers map to mark input elements, loop 0 to n to find the missing number, and analyze time and space: O(n) time, O(n) space for approach 2.
Apply the Gauss formula to compute the missing number in a 0..n sequence by comparing the expected sum n(n+1)/2 with the actual sum, achieving O(n) time and O(1) space.
Compute the missing number by summing the input and comparing to Gauss's formula for zero to n. Subtract to reveal and return the missing value; full code is in repository.
Count primes less than a given non-negative n using a brute force trial division approach, checking divisibility from two up to the current number and handling edge cases.
Walk through the pseudocode for a brute force prime check, showing nested loops that test divisibility, count primes below the input, and analyze time complexity O(n^2) with O(1) space.
Discover a better solution with sieve toothiness to identify primes up to n by marking non-primes, starting from i squared, using an isprime array and counting true values.
Walk through the sieve of Eratosthenes for n = 34, marking multiples of primes and counting true entries to identify primes below 34.
Implement a sieve-style function to count primes up to n by marking non-primes in an isprime array. Initialize 0 and 1 as non-prime, loop sqrt(n), mark multiples, and tally primes.
Introduces the single number problem, explains unsorted input, and demonstrates the brute force approach using a hash map to count occurrences and identify the unique number.
Traverse the input to build a frequency map, then scan keys to find a value with a single occurrence, analyzing time and space complexity as O(n) and O(n).
Use two times the sum of unique elements minus the actual sum to find the single non-duplicated value, using a set to collect uniques; runs in O(n) time and space.
Implement a function that finds the single number in a list by counting occurrences with a map and returning the one that appears once.
Explore the optimal approach using bit manipulation and xor to find the single number in linear time with constant space. Learn binary representation, bit operations, and how duplicates cancel out.
Implement the optimal approach to find the single number using xor, by looping through inputs and updating a running value to reveal the unique element.
Want to master popular problem-solving techniques, data structures, and algorithms that interviewers love? Dive right in!
Crave step-by-step explanations for the industry's hottest interview questions? We've got you covered.
Looking to up your game in competitive programming? Buckle up for a thrilling journey!
Welcome to the course!
In this course, you'll have a detailed, step by step explanation of hand-picked LeetCode questions where you'll learn about the most popular techniques and problems used in the coding interview, This is the course I wish I had when I was doing my interviews. and it comes with a 30-day money-back guarantee
What is LeetCode?
LeetCode is essentially a huge repository of real interview questions asked by the most popular tech companies ( Google, Amazon, Facebook, Microsoft, and more ).
The problem with LeetCode is also its advantage, IT'S HUGE, so huge in fact that interviewers from the most popular companies often directly ask questions they find on LeetCode, So it's hard to navigate through the huge amount of problems to find those that really matter, this is what this course is for.
I spent countless hours on LeetCode and I'm telling you that you don't have to do the same and still be able to get a job at a major tech company.
Course overview :
In this course, I compiled the most important and the most popular interview questions asked by these major companies and I explain them, in a true STEP BY STEP fashion to help you understand exactly how to solve these types of questions.
The problems are handpicked to ensure complete coverage of the most popular techniques, data structures, and algorithms used in interviews so you can generalise the patterns you learn here on other problems.
Each problem gets multiple videos :
Explanation and intuition video(s): we do a detailed explanation of the problems and its solution, this video will be longer because we will do a step by step explanation for the problems.
Coding video(s): where we code the solution discussed in the explanation video together.
Walkthrough video(s): where we go over each line of code and see what it does
We will use basic c++ for this course to code our solutions, previous knowledge in c++ is preferred but NOT required for the coding part of the course.
The problems are categorised for easier navigation and will be regularly updated with more popular and interesting problems.
Some of the stuff this course will cover are :
Arrays and Strings interview questions.
Searching interview questions and algorithms.
Dynamic Programming interview questions.
Backtracking interview questions ( With step by step visualisation ).
Trees and Graphs interview questions and algorithms.
Data structures Like Stacks, Queues, Maps, Linked Lists, and more.
In other words, this course is your one-stop-shop for your dream job.