5 kyu
Find All the Possible Numbers Multiple of 3 with the Digits of a Positive Integer.
208 of 303raulbc777
Description:
Given a certain number, how many multiples of three could you obtain with its digits?
Suposse that you have the number 362. The numbers that can be generated from it are:
362 ----> 3, 6, 2, 36, 63, 62, 26, 32, 23, 236, 263, 326, 362, 623, 632
But only 3, 6, 36, 63
are multiple of three.
We need a function that can receive a number and may output in the following order:
the amount of multiples
the maximum multiple
Let's see a case the number has a the digit 0 and repeated digits:
6063 ----> 0, 3, 6, 30, 36, 60, 63, 66, 306, 360, 366, 603, 606, 630, 636, 660, 663, 3066, 3606, 3660, 6036, 6063, 6306, 6360, 6603, 6630
In this case the multiples of three will be all except 0
6063 ----> 3, 6, 30, 36, 60, 63, 66, 306, 360, 366, 603, 606, 630, 636, 660, 663, 3066, 3606, 3660, 6036, 6063, 6306, 6360, 6603, 6630
So the expected result given the above cases:
Given 362, should return [4, 63]
(amount of multiples = 4, maximum multiple = 63)
Given 6063, should return [25, 6630]
(amount of multiples = 25, maximum multiple = 6630)
The function will receive only positive integers (num > 0), and you don't have to worry for validating the entries.
Features of the random tests:
Number of test = 100
1000 ≤ num ≤ 100000000
Enjoy it!!
Fundamentals
Data Structures
Algorithms
Mathematics
Logic
Strings
Permutations
Similar Kata:
Stats:
Created | Nov 13, 2016 |
Published | Nov 13, 2016 |
Warriors Trained | 1753 |
Total Skips | 189 |
Total Code Submissions | 1966 |
Total Times Completed | 303 |
Python Completions | 208 |
Ruby Completions | 26 |
JavaScript Completions | 85 |
Total Stars | 80 |
% of votes with a positive feedback rating | 82% of 74 |
Total "Very Satisfied" Votes | 53 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 3 kyu |
Lowest Assessed Rank | 6 kyu |