I need to check in Java if a word consists of unique letters (case insensitive). As straight solution is boring, I came up with:
You can optimize the first solution(indexof == lastindexof) just by checking the condition for all the 26 alphabets i.e. for a, b, c, d,..,z. So this way you don't have to traverse all the string.