Arrays
Lists of values: scanning, summing, shifting and building new lists.
| Status | Challenge | Topics | Level | Accepted | Save |
|---|---|---|---|---|---|
| 1.Sum of a listRead a list of numbers and print their total. | BasicsArrays | Easy | – | ||
| 2.Two SumFind the two positions whose numbers add up to a target. | ArraysHash maps | Easy | 100% | ||
| 3.Merge Sorted ArraysMerge two sorted arrays into one sorted array. | ArraysTwo pointersSorting | Easy | – | ||
| 4.Best Time to TradePick one day to buy and a later day to sell for the biggest profit. | ArraysGreedy | Easy | – | ||
| 5.Contains DuplicateCheck whether any number appears twice. | ArraysHash maps | Easy | – | ||
| 6.Missing NumberFind the one number missing from 0 to n. | ArraysMathBit manipulation | Easy | – | ||
| 7.Single NumberEvery number appears twice except one; find it. | ArraysBit manipulationHash maps | Easy | – | ||
| 8.Move ZerosMove every zero to the end, keeping the other numbers in order. | ArraysTwo pointers | Easy | – | ||
| 9.Binary SearchFind a number's position in a sorted array in log time. | ArraysBinary search | Easy | – | ||
| 10.Majority ElementFind the value that fills more than half of the array. | ArraysHash maps | Easy | – | ||
| 11.Plus OneAdd one to a number stored as an array of digits. | ArraysMath | Easy | – | ||
| 12.Squares of a Sorted ArraySquare every number of a sorted array and keep it sorted. | ArraysTwo pointersSorting | Easy | – | ||
| 13.Product Except SelfFor each position, multiply every other number, without dividing. | Arrays | Medium | – | ||
| 14.Maximum SubarrayFind the largest sum of a run of consecutive numbers. | ArraysDynamic programmingGreedy | Medium | – | ||
| 15.Top K FrequentReturn the k values that appear most often. | ArraysHash mapsSorting | Medium | – | ||
| 16.Three SumFind every distinct triple of numbers that adds up to zero. | ArraysTwo pointersSorting | Medium | – | ||
| 17.Container With Most WaterPick two walls that hold the most water between them. | ArraysTwo pointersGreedy | Medium | – | ||
| 18.Rotate MatrixTurn a square grid of numbers 90 degrees clockwise. | MatricesArrays | Medium | – | ||
| 19.Spiral MatrixRead a grid in a clockwise spiral from the outside in. | MatricesArrays | Medium | – | ||
| 20.Search in a Rotated ArrayBinary-search a sorted array that has been rotated. | ArraysBinary search | Medium | – | ||
| 21.Merge IntervalsMerge every pair of overlapping intervals. | ArraysSorting | Medium | – | ||
| 22.Days Until WarmerFor each day, count the days until a warmer one. | ArraysStacks | Medium | – | ||
| 23.Jump GameDecide whether you can jump from the first square to the last. | ArraysGreedyDynamic programming | Medium | – | ||
| 24.Subarray Sum Equals KCount the runs of consecutive numbers that add up to k. | ArraysHash maps | Medium | – | ||
| 25.Trapping Rain WaterWork out how much rain water a skyline of bars holds. | ArraysTwo pointersStacks | Hard | – | ||
| 26.Median of Two Sorted ArraysFind the median of two sorted arrays taken together. | ArraysBinary search | Hard | – | ||
| 27.Largest Rectangle in a HistogramFind the biggest rectangle that fits under a bar chart. | ArraysStacks | Hard | – | ||
| 28.Sliding Window MaximumReport the largest number in every window of k as it slides along. | ArraysSliding window | Hard | – |