Company: Booking holdings_9aug
Difficulty: medium
Deciding Schedule Problem Description In a company, an employee receives a fixed amount, fixedPay dollars, each day they work. They also receive a bonus, bonus dollars, on a workday if they worked the day before. The employee is planning their work schedule for n days. Their schedule is given as a binary string schedule where 'T' is a workday, and 'O' is not. The employee can change up to k days off ('O') to workdays ('T'). Find the maximum earnings the employee can get after changing at most k days from 'O' to 'T'. Examples Example 1: Input: n = 5, k = 2, fixedPay = 1, bonus = 2, schedule = "10100" Output: 10 Explanation: An optimal way to change the schedule is to work on the second and fourth days. In this case, the schedule becomes "11110". On the first day, earnings = fixedPay = 1. On days 2, 3, and 4, earnings = fixedPay + bonus = 3. Total earnings = 1 + 3 + 3 + 3 + 0 = 10. Return 10. Sample Case 0: Input: schedule = "100101" k = 2 fixedPay = 4 bonus = 3 Output: 29 Explanation: A