
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Prepare for common coding interview questions with LeetCode in Java: algorithms coding interview questions plus solution course, featuring comprehensive line-by-line video explanations and a money-back guarantee.
Solve fizzbuzz in Java from 1 to n by printing fizz for multiples of 3, buzz for multiples of 5, fizzbuzz for both, otherwise the number as a string.
Learn to solve the single number problem (LeetCode 136) in Java by using bitwise xor to cancel pairs, achieving linear time and constant space as you scan the array.
Learn to determine if an integer is a palindrome without string conversion by reversing the half digits, handling negatives and trailing zeros, with Java implementation for LeetCode 9.
Learn to compute trailing zeros in n! by counting multiples of five, not the factorial itself, using successive division by powers of five for a logarithmic time solution.
Learn to reverse an integer (LeetCode 7) within 32 bit range, handle overflow by comparing against max/min divided by ten, and implement an efficient O(log n) solution with constant space.
Learn to implement pow(x, n) efficiently by dividing n by two and multiplying x by x, handling negative n and 32-bit edge cases with long to achieve O(log n) time.
Convert a roman numeral to an integer by scanning left to right with a map of i, v, x, l, c, d, m; subtract when left value is smaller.
Convert integers to roman numerals using a 13-symbol table and subtraction rules, starting from the highest value and appending symbols like i, v, x, l, c, d, m.
Learn to reverse a character array in place using a two-pointer technique in Java, swapping elements with a temporary variable to achieve linear time and constant space.
solve the longest common prefix problem by assuming the first string as the prefix variable and trimming it with substring until all strings start with it, achieving linear time.
Solve the leetcode 187 repeated dna sequences problem by generating all substrings of length 10 and using hash map or hash set to identify sequences that appear more than once.
Solve the valid anagram problem (LeetCode 242) using a hash map, then optimize to constant space with a 26 letter array, including length checks and time and space insights.
Learn to find the longest palindromic substring using expand around center, tracking start and end to update the result while evaluating time and space complexity.
Solve the longest substring without repeating characters using a two-pointer sliding window and a hashmap to track indices; move the left pointer on duplicates to achieve linear time.
Solve the LeetCode 151 'reverse words in a string' problem in place by reversing the whole string, then each word, and cleaning up spaces.
Learn to apply binary search on sorted arrays to find a target's index in log time, returning -1 when not found, using left, right, and mid.
Learn to solve rotated sorted array search problems with a modified binary search, achieving logarithmic time by identifying the sorted half and narrowing to the target index or minus one.
Solve LeetCode 153: find the minimum in a rotated sorted array using modified binary search, achieving logarithmic time by locating the decreasing part with left, right, and mid pointers.
Solve the two sum problem with a single-pass hash map, returning indices of two numbers that add to the target in linear time, ensuring exactly one solution and no duplicates.
Move zeros to the end of an array in place, preserving non-zero order, using a two-pointer in-place algorithm with constant space after a queue-based approach.
Master the best time to buy and sell stock using a two-pointer approach to maximize profit in linear time with constant space, returning zero when profitable trades are impossible.
Determine if a ransom note can be formed from magazine letters using a 26-letter frequency array in Java. Compare with a hash map approach, achieving O(M+N) time and O(26) space.
Explore solving contains duplicate in an integer array (LeetCode 217) using sorting to flag adjacent duplicates and a hash set for linear time with constant space.
Learn the length of the last word problem from LeetCode 58 by scanning right to left with two pointers to skip trailing spaces and count the last word length.
Learn to solve the best time to buy and sell stock ii by summing all increasing price differences, enabling multiple transactions with one stock at a time.
Rotate the array to the right by k steps using the reversal method: reverse the entire array, then the first k, then the rest, implemented in Java for LeetCode 189.
Solve the jump game on an array of integers with a greedy approach. Track the furthest reachable index to see if you can reach the last index in O(1) space.
Solve the product of array except self (LeetCode 238) without division using prefix and suffix products in linear time, a dynamic programming approach.
Master the sequential digits problem from LeetCode 1291 in Java by generating numbers with sequential digits within a low-high range, then filter and return the valid results.
Identify all missing numbers from one to n in the given array by marking visited indices and then collecting unmarked positions, achieving O(n) time and constant space.
Discover how to find all duplicates in an array of numbers from one to n in linear time and constant space by marking indices, as shown in LeetCode 442 examples.
Solve the first missing positive problem in linear time and constant space by in-place index marking, preprocessing negatives and zeros, then scanning for the first unmarked index.
Solve the next permutation (LeetCode 31) in place by finding the decreasing suffix, swapping with the next greater element, then reversing the suffix for the lexicographically next permutation—using constant space.
Learn to solve the largest subarray with zero sum by tracking running sums in a hash map with Java, achieving linear time and linear space for interview questions.
Learn to count contiguous subarrays with product strictly less than k using a sliding window and two pointers, illustrated with the nums [10,5,2,6] example for k=100.
Learn to count unique k-diff pairs in an array using a hash map, handle k equals zero separately, and achieve linear time and space complexity.
Solve the two sum II problem using a two-pointer approach on a sorted array to find a pair that adds to the target, returning one-based indices.
Learn how to determine if one string is a subsequence of another using a two-pointer approach, and implement a solution for the LeetCode 392 problem with example walkthroughs.
We use two pointers to remove duplicates from a sorted array in place, shifting unique elements to the left while maintaining their order and returning the length.
Explore the sort colors problem (leetcode 75) with a linear-time, single-pass solution using three pointers to arrange zeros, ones, and twos in place, achieving O(1) space.
Apply a two-pointer approach to determine if a string is a valid palindrome by considering only alphanumeric characters and ignoring case, implemented in java for LeetCode 125.
Learn to merge two sorted arrays in place into nums1 in linear time with constant space using two pointers from the end, handling edge cases and maintaining sorted order.
solve the three sum problem by sorting the array and using a left-right two-pointer approach to find zero-sum triplets, while skipping duplicates for an efficient O(n^2) solution.
Tackle the valid parentheses problem (LeetCode 20) by using a hashmap to map closing to opening brackets and a stack to ensure each opening is closed by the same type.
Use a stack to solve the asteroid collisions problem from LeetCode. Move positive values to the right, negative to the left; larger sizes destroy smaller, and equal sizes both destroy.
Learn a stack-based solution to the longest valid parentheses problem (LeetCode 32), using a boundary sentinel and indices to compute the maximum length efficiently with linear time and space.
Decode string (LeetCode 394) by using two stacks and a string builder to decode encoded patterns with digits and brackets, including nested cases, in Java.
Explore solving the largest rectangle in histogram (LeetCode 84) with a stack, using a heights array to compute the maximum area where each bar has width one.
Master Kadane's algorithm in java to find the maximum subarray sum in linear time, using two variables for a contiguous, best-sum segment with O(1) space.
Master the majority element problem with the Boyer-Moore voting algorithm, learn brute-force and hash map approaches, and implement a linear-time, constant-space solution for LeetCode 169.
Learn to sort arrays with merge sort in Java, solving LeetCode interview questions without built-in sorts by dividing and merging sorted subarrays with O(n log n) time and O(n) space.
Explore counting inversions in an array with a merge sort approach, achieving O(n log n) time and O(n) space, and implement the solution in Java for coding interviews.
Sorts an array with quicksort by selecting a pivot, partitioning into left and right subarrays, and recursively sorting them to ascending order with O(n log n) time and O(n) space.
Master quickselect to find the kth largest or smallest element in an unsorted array, transforming to kth smallest via n-k, with pivot-based partition and O(n) average time, O(log n) space.
Solve the matrix diagonal sum by summing the main diagonal (r=c) and the secondary diagonal (r+c=n-1), handle overlap when n is odd, in O(n^2) time with O(1) space.
solve the transpose matrix problem (LeetCode 867) by flipping the matrix over the main diagonal, handling both square and non-square matrices, and explaining in-place and out-of-place approaches and their complexities.
Rotate a square matrix by 90 degrees clockwise via a transpose and row reversal; flip along the main diagonal and reverse each row, achieving O(n^2) time and O(1) space.
Learn to solve set matrix zeroes (LeetCode 73) in place with constant space by using the first row and column as markers, preprocessing, and then nullifying rows and columns.
Demonstrate solving LeetCode 1706 by simulating balls in a grid of -1 and 1, tracing paths to the floor, marking unreachable balls, and returning a column result array.
Build a dynamic programming table to support 2D range sum queries on an immutable matrix. Achieve constant-time submatrix queries and analyze the accompanying time and space complexity.
Welcome to "LeetCode in Java: Algorithms Coding Interview Questions" course!
In this course, you'll have a detailed, step by step explanation of classical hand-picked LeetCode Problems where you'll learn about the optimum ways to solve technical coding interview question. This is the course I wish I had when I was preparing myself for the interviews. This course comes with a 30-day money-back guarantee. So nothing to lose!
What is LeetCode?
LeetCode is a huge repository of real interview questions asked by the most popular tech industries( Google, Amazon, Facebook, Microsoft, Apple, Quora, LinkedIn, Bloomberg, Uber, Goldman Sachs, Twitter and more ).
Interviewers from the most popular companies(like Google, Amazon, Facebook, Uber, Twitter etc.) often directly ask questions they find on LeetCode. It's hard to navigate through the large amount of problems(around 1500) to most important questions, this is what this course stand for.
I spent countless hours on LeetCode. From my experience, I'm telling you that you don't have to do the all problem and still be able to get a job at a big tech industry.
By the time you're finished with the course, you will be prepared for common technical coding interview questions.
See you inside the course!