findpattern
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "findpattern", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "I am tired of this s**t", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,7 @@ | ||
# EXAMPLE | ||
So, I see that some test asking for a solution like this... enjoy! | ||
"The test ask to have count of groups pr count of word of subsequence" | ||
```javascript | ||
@@ -34,14 +39,29 @@ const findPattern = ( word ) => { | ||
}; | ||
// test it: | ||
console.log( findPattern('abcabc') ); // -> 2 groups | ||
console.log( findPattern('cccc') ); // -> 4 chars | ||
``` | ||
## HOW IT'S WORKS | ||
# ANOTHER EXAMPLE | ||
test it: | ||
So, I see that some test asking for a solution like this... enjoy! | ||
"The test ask to have the length about on not repeated subsequence" | ||
```javascript | ||
// 'abcabc' = 2 groups | ||
console.log( findPattern('abcabc') ); | ||
var findPattern = function( word ) { | ||
const count = new Set(word); | ||
return count.size; | ||
}; | ||
// test it: | ||
// cccc = 4 repeated chars | ||
console.log( findPattern('cccc') ); | ||
console.log( findPattern('abcabc') ); // -> 3 | ||
console.log( findPattern('cccc') ); // -> 1 | ||
``` | ||
10932
66