Hey, good one! my solution is to cumulate them in prior [1, 0, -1] will be [1, 1, 0] and then -> current = ( current + shift ) % 26 for i, char in enumerate(res): current = ord(char) - ord('a') current = (current + moves[i]) % 26 res[i] = chr(current + ord('a')) So I believe, asymptotically they are same, but yours is faster due to fewer iterations.
@TheMarioProductionz5 күн бұрын
Learned something new today. Thanks!
@redfinance34035 күн бұрын
How are you accessing January 5th problem when it is January 4th at the time of post (in NYC)? 🤔 vpn or something…