Skip to content
Optimal Lab

Practice · 6 problems

Intervals & Greedy

0 of 6 solved on this device

Watch it first · interactiveMerge overlapping intervals →Read the explainer · optimal-roundWhen to use it, and its look-alikes ↗
  1. 043Merge IntervalsGiven an array of intervals where intervals[i] = [start, end], merge all overlapping intervals and return the non-overlapping intervals covering all the input.Medium
  2. 044Jump GameYou are given an array `nums` where nums[i] is the maximum jump length from index i. Starting at index 0, return true if you can reach the last index.Medium
  3. 045Non-overlapping IntervalsGiven an array of intervals, return the minimum number you must remove so that the rest are non-overlapping.Medium
  4. 085Insert IntervalGiven a list of non-overlapping intervals sorted by start, insert a new interval and merge where necessary. Return the resulting sorted, non-overlapping list.Medium
  5. 086Gas StationThere are n gas stations in a circle. gas[i] is the fuel available at station i, and cost[i] the fuel needed to reach station i+1. Starting with an empty tank, return the index you must begin at to travel the circuit once, or -1 if it is impossible. If a solution exists it is unique.Medium
  6. 087Partition LabelsGiven a string `s`, partition it into as many parts as possible so that each letter appears in at most one part. Return a list of the part sizes, in order. The parts concatenated in order must reconstruct s.Medium