Marks :100
: 6 | : 0
An employee in an organization has begun working on N projects (numbered 0 to N-1). Each week he/she can work on a single module of one of the projects. The modules that are chosen on any two successive weeks should come from different projects. A project i can have at most Ci modules.
The modules of the projects are such that a module is completed in a week.
Write an algorithm to determine the number of weeks the employee can work on projects following the above-mentioned rules.
The first line of the input consists of an integer - num, representing the number of projects (N). ($$$1 \le num \le 5*10^4 $$$)
The next line consists of N space-separated integers - projC0, projC1, projCN-1, representing the number of modules of the projects.($$$1 \le projCi \le 10^7$$$)
Print an integer representing the maximum number of weeks the employee can work on the projects
3 7 2 3
11
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.