Algorithm · Google · Hard
Implement time_to_empty(checkpoints, current_soc). You are given a battery discharge log as a list of (minutes, soc) pairs sorted by minutes. Each soc is a state-of-charge percentage. Raw readings may contain charging artifacts and repeated SOC levels, so clean the data before using it: Discard a reading if its soc is greater than the previously retained reading's soc. If multiple readings have the same soc, keep only the one with the largest minutes and remove the others.…
Checking your access…