Learning from mistake…
October 14, 2007 Me No CommentsI just completed my Internship interview… Guess what, I did badly. I am so nervous and couldn’t think straight when the interviewer ask me to solve the algorithm. It’s been quite sometimes I never gone through any interview… and this time, I am disappointed with myself…The algorithm being asked is actually quite simple, but my brain is totally stop functioning. I prepared myself for the past one week and trained myself to get ready for this interview, but…
With only 5 min, I need to do reverse algorithm with string of characters. It’s easy and yes it’s easy. But I took over 10 minutes to solve the problem.
Below is the code that I wrote:
public static char[] reverse(char[] str) {
char tmp='';
for (int i=0; i<str.length; i++) {
if (i < (str.length-1-i)) {
tmp = str[i];
str[i] = str[str.length-1-i];
str[str.length-1-i] = tmp;
}
}
return str;
}
Well, what I need to do not only polishing my algorithm skill but how to work in constraint time and be calm….
The news for this internship will be next week, but I believe I cant make it. So Linda, learn from experience….
