How to check if a word is an Isogram? (meaning it doesn’t have repeating letters)
An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case.
Example: (Input → Output)
“Dermatoglyphics” → true “aba” → false “moOse” → false (ignore letter case)
isIsogram "Dermatoglyphics" = true
isIsogram "moose" = false
isIsogram "aba" = false
For me, as a reflect, whenever I see the unique keyword in any problem, I immediately think about Sets.
public class Kata
public static bool IsIsogram(string str)
var value = str.ToLower();
var set = new HashSet<string>();
foreach(char c in value)
return set.Count == value.Length ? true : false;