3 ms·
I started writing a solution and then stopped partway through because the pressure of getting it right in one shot was incredibly stressful. If this were given
by chipsy 17y ago
I started writing a solution and then stopped partway through because the pressure of getting it right in one shot was incredibly stressful.
If this were given to me for an interview question, I'd be incredibly meticulous and build a series of algorithms for len=0, len=1, len=2, etc., including various permutations of values, until I establish a general solution, which I would then submit for the final answer.
I would hardly ever do that in actual coding, though, because I could rely on hammering it with tests instead.