How would you reverse a the words in a string? (Be able to defend answer)
Anonymous
I got the other idea of not using a buffer (a better solution) String reverseWithoutBuffer(String s){ if (s.length() == 0 || s.length() == 1){return s;} length = s.length()-1; i = 0; while (i != length){ String s1 = s[i]; s[i] = s[length]; s[length] = s1; i--; length--; } return s; } //did not test it or walk through it, use at your own risk
Check out your Company Bowl for anonymous work chats.