Description
Solution
Problem
Given a string, find the number of unique characters using JavaScript Set and Map data structures.
Examples
Example 1:
Input: s = "hello"
Output: 4
Explanation: The unique characters are 'h', 'e', 'l', 'o'. Note that 'l' appears twice but is counted once.
Example 2:
Input: s = "programming"
Output: 8
Explanation: The unique characters are 'p', 'r', 'o', 'g', 'a', 'm', 'i', 'n'.
Constraints
1 ≤ s.length ≤ 1000
s consists of lowercase English letters only
Code Editor