There were two problems, with 75 minutes in total.
First problem:
Given an initial work schedule for n days, an employee earns a fixed amount for each working day. If the previous day was also a working day, the employee earns an additional bonus. The employee may change at most k days off into working days, but may not change a working day into a day off. The goal is to choose which days off to change so that total earnings over the n days, including base pay and consecutive-workday bonuses, are as large as possible. Return that maximum total.
Second problem:
Given a password string s and a positive integer period k, split the string from left to right into groups of k characters. If the last group has fewer than k characters, use its actual length. Every resulting substring must be a palindrome. Each operation may replace any character in the string with any other character. Find the minimum number of replacements needed to satisfy this requirement.
Discussion
Loading comments…