Last active
November 21, 2017 04:48
-
-
Save David-Hackro/d8dad4277322f6735af4dae4a40f0b0d to your computer and use it in GitHub Desktop.
exercises in java
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 class MyClass { | |
public static void main(String args[]) { | |
getUnicLetter("esta es una cadena con letras repetidas",""); | |
} | |
public static String getUnicLetter(String originalWord,String finalWord){ | |
if(originalWord.isEmpty()) return null; | |
System.out.print(finalWord); | |
return getUnicLetter(originalWord.replace(originalWord.substring(0,1),""),finalWord.contains(originalWord.substring(0,1)) ? "" : originalWord.substring(0,1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i need change this solution, becase i cant use the substring because create a new string constantly :(