4 kyu
How many numbers III?
2,205 of 4,440raulbc777
Description:
We want to generate all the numbers of three digits where:
- the sum of their digits is equal to
10
- their digits are in increasing order (the numbers may have two or more equal contiguous digits)
The numbers that fulfill these constraints are: [118, 127, 136, 145, 226, 235, 244, 334]
. There are 8
numbers in total with 118
being the lowest and 334
being the greatest.
Task
Implement a function which receives two arguments:
- the sum of digits (
sum
) - the number of digits (
count
)
This function should return three values:
- the total number of values which have
count
digits that add up tosum
and are in increasing order - the lowest such value
- the greatest such value
Note: if there are no values which satisfy these constaints, you should return an empty value (refer to the examples to see what exactly is expected).
Examples
find_all(10, 3) => [8, 118, 334]
find_all(27, 3) => [1, 999, 999]
find_all(84, 4) => []
Features of the random tests:
- Number of tests:
112
- Sum of digits value between
20
and65
- Amount of digits between
2
and17
Fundamentals
Data Structures
Algorithms
Mathematics
Logic
Similar Kata:
Stats:
Created | Jan 12, 2017 |
Published | Jan 12, 2017 |
Warriors Trained | 25518 |
Total Skips | 7852 |
Total Code Submissions | 31360 |
Total Times Completed | 4440 |
Python Completions | 2205 |
Ruby Completions | 197 |
JavaScript Completions | 940 |
Java Completions | 612 |
C# Completions | 245 |
Crystal Completions | 8 |
Haskell Completions | 83 |
Rust Completions | 71 |
Go Completions | 62 |
D Completions | 2 |
Julia Completions | 8 |
C++ Completions | 131 |
Swift Completions | 10 |
Scala Completions | 6 |
OCaml Completions | 3 |
Total Stars | 969 |
% of votes with a positive feedback rating | 92% of 658 |
Total "Very Satisfied" Votes | 571 |
Total "Somewhat Satisfied" Votes | 75 |
Total "Not Satisfied" Votes | 12 |
Total Rank Assessments | 8 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |