len(known) + lost times. The results of lost rolls went missing, and the rest are recorded in the array known. What they do know is that the average of all the rolls is exactly the integer average.
Restore the lost rolls: return a list of lost values from 1 to 6 that make the average of all rolls equal average. The values must be spread **as evenly as possible**, meaning any two of them differ by at most 1. They may be returned in any order.
If no such values exist, return an empty list.known=[6, 1, 2], average=3, lost=2 → [3, 3]
Five rolls averaging 3 sum to 15. The known ones give 9, so the two lost dice share 6, most evenly as 3 and 3.
known=[1, 1], average=2, lost=3 → [3, 3, 2]
All five rolls sum to 10, leaving 8 for the three lost dice: most evenly 3, 3 and 2, in any order.
known=[6, 6, 6], average=2, lost=1 → []
The total must be 8, but the known rolls already make 18, so there is no way: the answer is empty.
known=[6, 1, 2], average=3, lost=2
[3, 3]
Run checks the first 3 tests in your browser. Submit checks all 116 tests on the server, hidden ones included.