4 ms·
If this is given in Javascript, I'd rate the promise solution higher since a Javascript job involves a ton of promisified async code like this. If this is given
by gloosx 1y ago
If this is given in Javascript, I'd rate the promise solution higher since a Javascript job involves a ton of promisified async code like this. If this is given in C or pseudo-code, then for sure a good ol stack+flag+loop is looking good enough.