Check Unique Characters

Easy~10 min

Given a string s, determine if all characters in the string are unique (i.e., no character appears more than once).

Return true if all characters are unique, or false if any character is repeated.

Examples

Example 1
Input: s = "abcdef"
Output: true
Explanation: All 6 characters are different.
Example 2
Input: s = "hello"
Output: false
Explanation: The character "l" appears twice.
Example 3
Input: s = ""
Output: true
Explanation: An empty string trivially has all unique characters.

Constraints

  • 0 <= s.length <= 10^4
  • s consists of lowercase English letters, digits, and/or common punctuation.
Code
Ctrl+EnterRun|Ctrl+⇧+EnterSubmit
Output

Run your code to see results

Use Cmd+Enter to run