I've had this happen to me in an interview before, from the other side.
I laughed that I had given them such an easy problem for their chosen language, then said "ok, pretend you went back in time and you're the person writing that function for the std lib" and so they did.
It probably wasn't as optimized as the actual stdlib function but it was good enough for the interview.
I gotta say if someone got heated with me about that request I'd end the interview early and not give them the job too.
The point isn't just providing a solution it's demonstrating that you can work through a simple problem. If you get heated about that during an interview then I don't get any info about your ability to work through problems, and I do get the impression that you're short tempered when asked to do things you don't care about.
Not OP but I dont think they got heated because they were asked to reason/invent stdlib function, it seems they got heated because they got disqualified for using stdlib function without knowing the exact algo the function uses beforehand.
I laughed that I had given them such an easy problem for their chosen language, then said "ok, pretend you went back in time and you're the person writing that function for the std lib" and so they did.
It probably wasn't as optimized as the actual stdlib function but it was good enough for the interview.
I gotta say if someone got heated with me about that request I'd end the interview early and not give them the job too.
The point isn't just providing a solution it's demonstrating that you can work through a simple problem. If you get heated about that during an interview then I don't get any info about your ability to work through problems, and I do get the impression that you're short tempered when asked to do things you don't care about.