Created
February 3, 2022 07:32
-
-
Save blessedjasonmwanza/3cab38aa94f8a94431c82c816a68f700 to your computer and use it in GitHub Desktop.
Count length of unique characters in a string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} s | |
* @return {number} | |
*/ | |
var lengthOfLongestSubstring = function(s) { | |
const unique = new Set(s.split('')); | |
return Array.from(unique).length; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment