3 ms·
I'm pretty sure if you use a sorted map you can do this in n log n time, still with just n space. edit: https://www.jdoodle.com/a/pZv https://www.jdoodle.com/a
by pianom4n 9y ago
I'm pretty sure if you use a sorted map you can do this in n log n time, still with just n space.
edit: https://www.jdoodle.com/a/pZv https://www.jdoodle.com/a/pZv