Activity Selection Problem - Hackerrank Problem Solution
Activity Selection Problem
Hackerrank Problem Solution
PROBLEM STATEMENT
You are given a set of Activities with their start and finish time. Prints a maximum set of activities that can be done by a single person, one at a time. n : total number of activities id[]: IDs of activities s[] : an array that contains start time of all activities f[] : an array that contains finish time of all activities
You are given a set of Activities with their start and finish time. Prints a maximum set of activities that can be done by a single person, one at a time. n : total number of activities id[]: IDs of activities s[] : an array that contains start time of all activities f[] : an array that contains finish time of all activities
Input Format
First line contains total number of activities, n. Second line contains n space separated integers denoting IDs of activities. Third line contains n space separated integers denoting start time of the activities. Forth line contains n space separated integers denoting finish time of the activities.
Constraints
5≤n≤50, where n is the number of activities.
Output Format
Print the space separated IDs of activities which can be performed in a single line
Sample Input 0
6
1 2 3 4 5 6
1 3 0 5 8 5
2 4 6 7 9 9
Sample Output 0
1 2 4 5
SOLUTION IN C
SHARE
If you find this useful, please share with your friends and Community.
CODE TOGETHER..GROW TOGETHER.
CODE TOGETHER..GROW TOGETHER.
Newer Posts
Newer Posts
Older Posts
Older Posts
Comments