Check whether all characters are unique
Coding problemEasyAsked in: Capgemini
Given a string s, return true if no character appears more than once, and false otherwise.
Upper and lower case are different characters, and spaces count like any other character. An empty string has no repeats.
Examples
Example 1
Input: s = "qwerty"
Output: true
Example 2
Input: s = "Hello"
Output: false
l appears twice.
Example 3
Input: s = "Aa"
Output: true
Constraints
- The length of s is between 0 and 100,000
- s holds printable ASCII characters only
Run checks the 3 examples. Submit also runs the hidden tests: edge cases, large inputs and a time limit.
Run your code to see the results here. Ctrl or Cmd + Enter runs; add Shift to submit.