6 kyu

Ascend, Descend, Repeat?

894 of 1,958badfish1337

Description:

You are given three integer inputs: length, minimum, and maximum.

Return a string that:

  1. Starts at minimum
  2. Ascends one at a time until reaching the maximum, then
  3. Descends one at a time until reaching the minimum
  4. 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

Stats:

CreatedJul 9, 2022
PublishedJul 9, 2022
Warriors Trained4255
Total Skips95
Total Code Submissions16364
Total Times Completed1958
Python Completions670
Java Completions315
JavaScript Completions894
Haskell Completions36
Rust Completions67
Go Completions32
COBOL Completions2
C Completions16
Total Stars86
% of votes with a positive feedback rating89% of 298
Total "Very Satisfied" Votes241
Total "Somewhat Satisfied" Votes48
Total "Not Satisfied" Votes9
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • badfish1337 Avatar
  • ParanoidUser Avatar
  • Chrono79 Avatar
  • trashy_incel Avatar
  • kirull Avatar
  • akar-0 Avatar
Ad