6 kyu

Pack the box.

Description
Loading description...
Fundamentals
  • Please sign in or sign up to leave a comment.
  • Blind4Basics Avatar

    no example tests with left overs... (the specs are very weird and unintuitive, btw...)

  • myjinxin-2015 Avatar

    The description is very unclear. More details should be provided on how to place the boxes.

    • myjinxin-2015 Avatar

      For those who don't know the rules, this may be a more understandable explanation:

      Get a 'char' from 'string'
      in order from top to bottom, from left to right, Find a place where you can put it down
      if found such a place, put down the char. 
      otherwise, put this char aside, continue to try to put the next char.
      and so on.
      
    • dfhwze Avatar

      updated description, clear now?

    • myjinxin-2015 Avatar
      Suggestion marked resolved by myjinxin-2015 2 years ago
  • Voile Avatar
    expected 'N, o, P' to equal 'N, P'
    

    That's another missing spec: Elements that can't be filled will be skipped instead of halting the entire packing process.

    This is, again, not specified anywhere, and only exists in the random tests. And this doesn't make much sense either (if you can't pack everything in a box, you can't pack everything in anyways so trying to pack more elements into the box is futile).

    • dfhwze Avatar

      Specification updated. 2 Examples added to show both possible cases (box completely filled, box filled with as much as possible)

  • Voile Avatar

    It is unspecified what happens if an upper case letter is encountered but the first available space do not have 2x2 space available, such as:

    box:
    ###
    ###
    ###
    
    string: abC
    

    When C is filled there is no space for it at the first available slot:

    ab#
    ###
    ###
    

    Similarly, string = AbcDefg gives

    AAb
    AAc
    ###
    

    at D, which again has no space for D but has space for efg.

    • Voile Avatar

      More complicated case:

      box:
      #####
      #####
      #####
      
      string=abCDefghi
      

      After abCD:

      abCC#
      DDCC#
      DD###
      

      Where does e go? at the spot to the right of C?

      Either the entire semantics of packing needs to be specified, or it needs to be clearly defined what first available space means.

    • dfhwze Avatar

      Updated description and added test cases in example section of description to show behavior.

  • FruitingBat Avatar

    This comment has been hidden.