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.
Showing 1–10 of 135 • 0 solved
Goeasy1.Two Sum
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.
Goeasy121.Best Time to Buy and Sell Stock
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.
Goeasy217.Contains Duplicate
Return true if any value appears at least twice in the array, and false if every element is distinct.
Gomed238.Product of Array Except Self
Return an array in which answer[i] is the product of every element of nums except nums[i]. Solve it without using division.
Gomed53.Maximum Subarray
Find the contiguous subarray with the largest sum and return that sum.
Gomed152.Maximum Product Subarray
Find the contiguous subarray with the largest product and return that product. The array may contain negative numbers and zeros.
Gomed153.Find Minimum in Rotated Sorted Array
A sorted array of unique values has been rotated an unknown number of times. Return its minimum element in O(log n) time.
Gomed33.Search in Rotated Sorted Array
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.
Gomed15.3Sum
Return all unique triplets in the array that sum to zero. The result must not contain duplicate triplets.
Gomed11.Container With Most Water
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.