GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rulcode
  • Sign In

This view

  • Original page
  • New address

GeezerVison is showing rulcode.com — Activity Selection Visualizer & Solution | Rulcode

Fetching algorithms...

    Activity Selection Visualizer & Solution | Rulcode
    Loading problem details...

    37. Activity Selection

    Medium
    Topics
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: intervals = [[1,2],[2,3],[3,4],[1,3]]
    Output: 1
    Explanation: [1,3] overlaps with [1,2], [2,3], [3,4]. Remove [1,3] to obtain non-overlapping intervals.

    Example 2:

    Input: intervals = [[1,2],[1,2],[1,2]]
    Output: 2
    Explanation: You need to remove two [1,2] to make the rest of the intervals non-overlapping.

    Example 3:

    Input: intervals = [[1,2],[2,3]]
    Output: 0
    Explanation: You don't need to remove any of the intervals since they are already non-overlapping.

    Example 4:

    Input: intervals = [[1,100],[11,22],[1,11],[2,12]]
    Output: 2
    Explanation: Optimal solution involves removing [1,100] and either [1,11] or [2,12].

    Example 5:

    Input: intervals = []
    Output: 0
    Explanation: Empty input should return 0 as there are no intervals to remove.

    Constraints:

    • •
    • •
    • •

    Time Complexity

    O(n log n)

    Space Complexity

    O(1)

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.