Skip to content

sieberss/infinite-number-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Task

Assume an infinite string concatenating all natural numbers: 1234567891011121314...

Write a function that receives an arbitrary string of digits and returns the position of its first occurence within the infinite number string.

Examples

  • input "12" should return 0 because it appears directly at the beginning,
  • "10" should return 9 because if follows after "123456789",
  • "445" should return 79 because the first occurence is in the sequence ..434445.. with 79 digits before

It is a codewars kata of rank 2 (second most difficult), see https://www.codewars.com/kata/582c1092306063791c000c00

This is my solution of the task.

About

finding the first occurence of an arbitrary digit string in the infinite string of natural numbers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages