This was many years ago. Was asked how to reverse a string. Showed the standard String to char array and for loop. Was asked any other way? So I said that for production code, I would use the JDK StringBuilder reverse method.
Interviewer was not happy as I didn't mention recursive method. He kept on harping and I quickly wrote the recursive method on the whiteboard. I told him it's not practical. I told him politely that I would use the for loop for just discussion and interview purposes, the recursive method for academic discussion and the StringBuilder reverse string method for production code.
He was not happy and I didn't bother to go for the next round.
BI developer, analyst and reporting engineer, but most important...a lifelong learner.
I was told that I could become a coder. I am trying:) Let's see if it works out.
This was many years ago. Was asked how to reverse a string. Showed the standard String to char array and for loop. Was asked any other way? So I said that for production code, I would use the JDK StringBuilder reverse method.
Interviewer was not happy as I didn't mention recursive method. He kept on harping and I quickly wrote the recursive method on the whiteboard. I told him it's not practical. I told him politely that I would use the for loop for just discussion and interview purposes, the recursive method for academic discussion and the StringBuilder reverse string method for production code.
He was not happy and I didn't bother to go for the next round.
Can you imagine working with him/her in the future?