Practice Maximum Number of Weeks for Which You Can Work
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
milestones[i] is the remaining milestone count of project i. Finish exactly one remaining project milestone each week without taking breaks, and never work on the same project in consecutive weeks. Stop when no legal next milestone exists or every project is complete. Return the maximum possible number of working weeks for milestones.
Source: Maximum Number of Weeks for Which You Can Work on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
milestones = [1,2,3]
6
# Example 2
milestones = [5,2,1]
7
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Number of Weeks for Which You Can Work.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.