Created
November 9, 2014 10:03
-
-
Save vikitripathi/bd8fc7080fb58875b7e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String reverseRecursively(String str) { | |
//base case to handle one char string and empty string | |
if (str.length() < 2) { | |
return str; | |
} | |
return reverseRecursively(str.substring(1)) + str.charAt(0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment