Intel Corporation interview question

Write a recursive Java function to reverse a String object

Interview Answer

Anonymous

18 Jul 2015

public String reverse(){ if ( (str==null) || str.length()<=1) ){ return str; } return reverse(str.substring(1))+str.chatAt(0); }

6