6 kyu
Ascend, Descend, Repeat?
894 of 1,958badfish1337
Description:
You are given three integer inputs: length, minimum, and maximum.
Return a string that:
- Starts at minimum
- Ascends one at a time until reaching the maximum, then
- Descends one at a time until reaching the minimum
- repeat until the string is the appropriate length
Examples:
length: 5, minimum: 1, maximum: 3 ==> "12321"
length: 14, minimum: 0, maximum: 2 ==> "01210121012101"
length: 11, minimum: 5, maximum: 9 ==> "56789876567"
Notes:
- length will always be non-negative
- negative numbers can appear for minimum and maximum values
- hyphens/dashes ("-") for negative numbers do count towards the length
- the resulting string must be truncated to the exact length provided
- return an empty string if maximum < minimum or length == 0
- minimum and maximum can equal one another and result in a single number repeated for the length of the string
Fundamentals
Strings
Algorithms
Similar Kata:
Stats:
Created | Jul 9, 2022 |
Published | Jul 9, 2022 |
Warriors Trained | 4255 |
Total Skips | 95 |
Total Code Submissions | 16364 |
Total Times Completed | 1958 |
Python Completions | 670 |
Java Completions | 315 |
JavaScript Completions | 894 |
Haskell Completions | 36 |
Rust Completions | 67 |
Go Completions | 32 |
COBOL Completions | 2 |
C Completions | 16 |
Total Stars | 86 |
% of votes with a positive feedback rating | 89% of 298 |
Total "Very Satisfied" Votes | 241 |
Total "Somewhat Satisfied" Votes | 48 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |