← all problems

hasDuplicateLetter 🌶️🌶️

Write a method hasDuplicateLetter that takes a String s and returns true if some character appears more than once in it (anywhere, not necessarily next to each other), and false if all its characters are different. Capital and lowercase letters are different.

For example, hasDuplicateLetter("hello") is true, hasDuplicateLetter("world") is false, and hasDuplicateLetter("abca") is true.