Interview Prep Hub

LeetCode Challenges (135)

Curated problems solved in Go, JavaScript and SQL. Expand a problem to read what it asks, try it yourself, then hit Show solution for the approach and the full code.

Difficulty:

Showing 1–10 of 135 • 0 solved

Goeasy1.Two Sum
ArrayHash Table

Given an array of integers and a target value, return the indices of the two numbers that add up to the target. Exactly one valid answer exists and the same element may not be used twice.

Open on LeetCode ↗
Goeasy121.Best Time to Buy and Sell Stock
ArrayDynamic Programming

prices[i] is the price of a stock on day i. Choose one day to buy and a later day to sell, and return the largest profit achievable, or 0 if no profit is possible.

Open on LeetCode ↗
Goeasy217.Contains Duplicate
ArrayHash TableSorting

Return true if any value appears at least twice in the array, and false if every element is distinct.

Open on LeetCode ↗
Gomed238.Product of Array Except Self
ArrayPrefix Sum

Return an array in which answer[i] is the product of every element of nums except nums[i]. Solve it without using division.

Open on LeetCode ↗
Gomed53.Maximum Subarray
ArrayDynamic ProgrammingDivide and Conquer

Find the contiguous subarray with the largest sum and return that sum.

Open on LeetCode ↗
Gomed152.Maximum Product Subarray
ArrayDynamic Programming

Find the contiguous subarray with the largest product and return that product. The array may contain negative numbers and zeros.

Open on LeetCode ↗
Gomed153.Find Minimum in Rotated Sorted Array
ArrayBinary Search

A sorted array of unique values has been rotated an unknown number of times. Return its minimum element in O(log n) time.

Open on LeetCode ↗
Gomed33.Search in Rotated Sorted Array
ArrayBinary Search

A sorted array of distinct integers has been rotated at an unknown pivot. Return the index of the target value, or -1 if it is absent. Must run in O(log n) time.

Open on LeetCode ↗
Gomed15.3Sum
ArrayTwo PointersSorting

Return all unique triplets in the array that sum to zero. The result must not contain duplicate triplets.

Open on LeetCode ↗
Gomed11.Container With Most Water
ArrayTwo PointersGreedy

Each height[i] is a vertical line drawn at position i. Pick the two lines that together with the x-axis hold the most water, and return that area.

Open on LeetCode ↗