Created
June 14, 2020 14:57
-
-
Save YaroslavShapoval/442dde09db0589ce40f0baad78f1b9f9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const START = 1; | |
| const LENGTH = 990; | |
| const ONE_COUNTS = 261; | |
| let cur_length = 0; | |
| let cur_number = 0; | |
| let one_occurences = 0; | |
| // while (cur_length < LENGTH) { | |
| while (one_occurences < ONE_COUNTS) { | |
| cur_number++; | |
| cur_length += String(cur_number).length; | |
| one_occurences += (String(cur_number).match(/1/g) || []).length; | |
| } | |
| console.log(cur_length); | |
| console.log(cur_number); | |
| console.log(one_occurences); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment