3 ms·
I wrote the "function to reverse a string" in a job interview once. Then the interviewer reminded me that strrev() had been part of the standard C library since
by marshray 4mo ago
I wrote the "function to reverse a string" in a job interview once. Then the interviewer reminded me that strrev() had been part of the standard C library since K&R.
I'd been programming in C(++) for ~15 years by then and had never had the occasion to reverse a string. I still wonder whether that makes it a good job interview question, or a terrible one. Some of both probably.
- saagarjha 4mo agostrrev is not a standard C function. I actually don't think my computer even has it (it's a Mac).
- unrealhoang 4mo agoIt’s a good one, if you can still write functionally and same algorithmic complexity then it should not matter if you know strrev or not.
- marshray 4mo agoExcept that an extremely complex algorithm involving large data tables is required for Unicode or other modern text encodings.