Skip to the editor
JSGroundwork
JSGroundwork handwritten · web dev
←Back to Intervals

Ready to read

JSJavaScript⑂Git◎Interview prepΣDSA in JSSDSystem Design
More topics15›
</>HTML{ }CSS⚛ReactNNext.jsNeNest.jsTSTypeScriptNoNode.js🐳DockerDBSQL & Databases✓Testing🔒Web Security☁Cloud & DevOps◈GraphQL◆Redis☸Kubernetes
☰‹›
Description
All topics›JavaScript›Intervals

Non-overlapping Intervals

intermediatelayer I10 · Intervals5 tests

Given an array of intervals, return the minimum number you must remove so that the ones left over do not overlap.

  • Intervals that only touch at an endpoint, such as [1,2] and [2,3], do not overlap
  • The input is not sorted
  • An empty input needs no removals
  • Removing the fewest is the same as keeping the most — solve the easier one

Stuck?

All exercisesPlayground
1234567891011121314
loading the editor…

Nothing yet — hit Run and whatever you log shows up here.

Submit to see how you did.

⌘/Ctrl + Enter run⌘/Ctrl + S save⌘/Ctrl + / comment⌘/Ctrl + F find/replace⌘/Ctrl + D select next matchAlt + click multi-cursorTab indent · ⇧Tab outdentEsc leave fullscreen