Skip to content

Instantly share code, notes, and snippets.

@David-Hackro
Last active November 21, 2017 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save David-Hackro/d8dad4277322f6735af4dae4a40f0b0d to your computer and use it in GitHub Desktop.
Save David-Hackro/d8dad4277322f6735af4dae4a40f0b0d to your computer and use it in GitHub Desktop.
exercises in java
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));
}
}
@David-Hackro
Copy link
Author

i need change this solution, becase i cant use the substring because create a new string constantly :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment