Created
February 23, 2019 19:33
-
-
Save 4skinSkywalker/7b0855d1713663790f88d69786775d4f to your computer and use it in GitHub Desktop.
"...challenge where users struggled most to get a perfect score and spent the longest time solving.."
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
function questionsMarks(string) { | |
let number = pair = count = 0 | |
for (let char of string) { | |
if ( !isNaN(char) ) { | |
if (number && number + +char === 10) { | |
if (count !== 3) return false | |
pair = true | |
} | |
number = +char | |
count = 0 | |
} else if (char === '?') { | |
count++ | |
} | |
} | |
return pair || false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment