7 kyu

Numbers with this digit inside

286 of 5,551user5036852

Description:

You have to search all numbers from inclusive 1 to inclusive a given number x, that have the given digit d in it.
The value of d will always be 0 - 9.
The value of x will always be greater than 0.

You have to return as an array

  • the count of these numbers,
  • their sum
  • and their product.

    For example:
x = 11
d = 1
->
Numbers: 1, 10, 11
Return: [3, 22, 110]

If there are no numbers, which include the digit, return [0,0,0].

Have fun coding it and please don't forget to vote and rank this kata! :-)

I have created other katas. Have a look if you like coding and challenges.
Mathematics
Algorithms

Stats:

CreatedAug 12, 2016
PublishedAug 12, 2016
Warriors Trained12969
Total Skips1461
Total Code Submissions25390
Total Times Completed5551
C# Completions286
JavaScript Completions1271
Java Completions575
C++ Completions814
Python Completions1378
Ruby Completions248
PHP Completions431
F# Completions53
TypeScript Completions184
Haskell Completions106
CoffeeScript Completions12
Swift Completions466
Total Stars131
% of votes with a positive feedback rating88% of 1002
Total "Very Satisfied" Votes791
Total "Somewhat Satisfied" Votes180
Total "Not Satisfied" Votes31
Ad
Contributors
  • user5036852 Avatar
  • GiacomoSorbi Avatar
  • suic Avatar
  • candrabeqx Avatar
  • ParanoidUser Avatar
  • Dentzil Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • hobovsky Avatar
  • akar-0 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
  • AmirTallap Avatar
Ad