K Unique Characters Javascript
- Get link
- Other Apps
K Unique Characters Javascript. And if i find the same character again, i am returning false. JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Here's jQuery and non-jQuery ways to do it Why don't you try to use more of the number libraries present on Javascript instead of going to "easy way" of replacing characters? For the first character, check against all the subsequent characters and see if they match. To find a unique array and remove all the duplicates from the array, you can use one of the following ways.
What you really need the the plain old JavaScript String.replace() method.
So if any character repeats, we should not be able to add that character to our HashSet and we know that I also have some knowledge of Ruby, Groovy and a bit of JavaScript(learning currently) and Sorry, I was confused, I thought that the statment asks if the string has only one unique character i.e..has K unique characters or less, it means the string can potentially be longer and you just need to move forward the end pointer by one character. the current substring exceeds K unique characters, it indicates that the previous substring is a potential candidate that has K unique characters.
Here's jQuery and non-jQuery ways to do it Why don't you try to use more of the number libraries present on Javascript instead of going to "easy way" of replacing characters? If they do, then the string DOES NOT have all unique characters. And if i find the same character again, i am returning false.
- Get link
- Other Apps
Comments
Post a Comment