That sort is pretty bonkers. I agree with the no hire because it doesn’t really display an understanding but if I got that as an answer in a technical interview, it would be fun to dive into why that code was written and might turn into a hire if we peer just a bit deeper under the hood of the thinking. This is why “solve for x” technical questions suck unless you make the actual interview about the back and forth. Assume a correct premise if it works and tweak and change and poke and prod to really sus out if they understand what and why that was written.
That sort is pretty bonkers. I agree with the no hire because it doesn’t really display an understanding but if I got that as an answer in a technical interview, it would be fun to dive into why that code was written and might turn into a hire if we peer just a bit deeper under the hood of the thinking. This is why “solve for x” technical questions suck unless you make the actual interview about the back and forth. Assume a correct premise if it works and tweak and change and poke and prod to really sus out if they understand what and why that was written.