Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in --d --h --m --s-- days -- hours -- minutes -- seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 8d 11h 20m 46s8 days 11 hours 20 minutes 46 seconds.
Guide: Quant Brainteasers: 10 Classic Interview Puzzles and the Idea Behind Each
An integer array is updated in rounds. In each round, all changes are decided simultaneously from the array as it stood at the start of the round: an interior element that is strictly smaller than both its neighbours increases by 1, an interior element that is strictly larger than both neighbours decreases by 1, and everything else (including the first and last elements) is unchanged. Rounds repeat until a round changes nothing.
Starting from , give two numbers as a comma-separated list: (1) the number of rounds that change the array before it settles (do not count the final round that makes no change), and (2) the sum of the elements of the settled array.