5 kyu

Rearrangement of Numbers to Have The Minimum Divisible by a Given Factor

110 of 151raulbc777
Description
Loading description...
Fundamentals
Mathematics
Sorting
Logic
Strings
Algorithms
  • Please sign in or sign up to leave a comment.
  • Bazwell Avatar

    Why are the results so truncated? I can't debug my code with something like:

    With k = 1, arr = 47,81,43,130,32,107,311: expected 'Rearrangement: 107, 130, 311, 32, 43,…' to equal 'Rearrangement: 107, 130, 311, 32, 43,…'

  • B1ts Avatar

    Python: in rare cases some random tests expect 2 spaces before the word "generates" (when there are multiple rearrangements, to be exact).

    'Rearrangement: 149, 168, 2, 22, 64, 6 and 149, 168, 22, 2, 64, 6 generates: 149168222646 divisible by 2' 
    should equal 
    'Rearrangements: 149, 168, 2, 22, 64, 6 and 149, 168, 22, 2, 64, 6  generates: 149168222646 divisible by 2'
    
  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • akar-0 Avatar
  • devjskang Avatar

    Hi, I got this result from the first simple test.

    'Rearrangement: 32, 3, 34, 7, 12 generates: 32334712 divisible by 4' should equal 'Rearrangement: 12, 3, 34, 7, 32 generates: 12334732 divisible by 4'

    Mathematically, any combination which ends witn 12 or 32 could be divided by 4.

  • akar-0 Avatar
  • akar-0 Avatar
  • akar-0 Avatar

    Rust translation, I have included some changes in the description to facilitate the addition of other languages.

  • FArekkusu Avatar

    Empty it blocks must be removed from tests.

  • anter69 Avatar
    • the possibility of multiple rearrangements should be tested in the fixed tests, e.g. [1, 2, 22] --> 1222 (as [1, 2, 22] and [1, 22, 2] are both OK); now it's up to the random tests to generate such a case (or not)
    • 3 (or more) rearrangements should also be tested, e.g. [1, 2, 22, 222]
    • the required format for 3 (or more) possible arrangements should be specified: do you want "A, B and C" or "A and B and C" -- currently it's not tested
    • leading zeros could/should be tested, e.g. [0, 1, 2] --> 102 (not 12)
    • incorrect grammar when multiple rearrangements are possible: "Rearrangements: ... generates" should be "Rearrangements: ... generate" (without the final "s")
  • Voile Avatar

    Approved

  • raulbc777 Avatar

    An orthography mistake has been corrected: arrangement for the misspelled arrengement, so the function will be rearranger() instead of rearrenger() (misspelled).

  • ChristianECooper Avatar

    Hi, I'm getting this result from a random test:

    'Rearrengement: 124, 19, 20, 22, 2, 32 generates: 124192022232 divisible by 6' 
    

    should equal

    'Rearrengement: 124, 19, 20, 2, 22, 32 generates: 124192022232 divisible by 6'
    

    As you can see both answers are correct according to the instructions, the order of 2 and 22 in the answer makes no difference to the concatenated integer!