Activity Selection Problem Problem
Activity Selection Problem Problem — ExecCode Easy DSA Practice
Solve the Activity Selection Problem problem on ExecCode. Free online easy DSA practice in Greedy. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given:. Your task is to compute the required answer and return the maximum number of activities one person can attend without overlap. A student volunteer wants to attend as many campus events as possible in one day. Each event has: - a start time - a finish time The student can attend only one event at a time.
Examples
Input {"n": 6, "starts": [1, 3, 0, 5, 8, 5], "finishes": [2, 4, 6, 7, 9, 9]}; Output 4. Input {"n": 3, "starts": [10, 12, 20], "finishes": [20, 25, 30]}; Output 2. Input {"n": 1, "starts": [1], "finishes": [2]}; Output 1
Constraints
1 <= n <= 10^5
Practice Activity Selection Problem free on ExecCode. Browse DSA problems, topic map, and placement guides.