Solving This Question in Edabit:https://edabit.com/challenge/mdJmXLuw8dLxxdGLc using janky string and 2 for loops
I should learn how to use the map in java. haven't learnt yet but know that it exist🐧
I should try and come up with more challenging solutions. i think that I keep on doing the same things over again. not really learning anything new
Question:
Solution:
public class Challenge {
public static boolean noDuplicateLetters(String phrase) {
String newphrase = phrase.toLowerCase();
String check = "";
String[] words = newphrase.split(" ");
for(String i : words) {
check = "";
for(int j = 0; j < i.length(); j++) {
if(check.contains(Character.toString(i.charAt(j))))
return false;
check += i.charAt(j);
}
}
return true;
}
}