← 返回 amazon 的题目列表Maximum Vacation Days with Limited PTO
类型:online_judge
Given a weekly work record with 'W' as workday and 'V' as vacation day, and a given number of PTOs (paid time off) that can be used to substitute 'W' for 'V'. Find the maximum number of consecutive vacations you can take within the constraint of PTO usage.
Input:
string days: a weekly record composed of 'W' and 'V'.
int pto: maximum number of PTOs available.
Output: maximum number of consecutive vacation days.
Example:
Input: days = "WVWWVVVW", pto = 2
Output: 5
Explanation: Use 1 PTO to change the first workday into a vacation and use another PTO to change the third workday into a vacation, resulting in "VVVVVVVW", the maximum vacation length is 5.
Example
Input
"WVWWVVVW" 2