On the array sort…that is clever but it doesn’t return those values to something you can use; it just sorts them on screen. I respect the cleverness, but yeah, not useful.
This is not the reason it isn’t useful. The function could just as easily modify an array as print; you could also keep a list (or an atomic integer if that functionality is available) of which have been sorted and spin until it shows that every member has been sorted. Taking n milliseconds to sort an array whose highest element is n, with the cost of all of the thunks, plus the potential for a (very rare) race condition… not so great.
Regardless, I’d hire either of these programmers if there weren’t red flags elsewhere.
I don’t get this. Who cares if they forgot or just didn’t know the better solution? They were able to solve the problem under pressure, even if not in the most optimal way. They even remembered to handle the negative case, which is straight up a good sign (no pun intended). And while it’s slow, it would honestly still be fine to use in production anywhere you’d use typescript, as long as it’s not in a hot spot.
In my mind this tells me approximately as much about the programmer as if they wrote it using modulo.