why [0,0,11,5] needs 8 steps?...


  • 3
    Z

    my algorithm gives 7 steps and is considered wrong

    [0,0,11,5]:

    [1,1,10,4]
    [2,2,9,3]
    [3,3,8,2]
    [3,3,7,3]
    [3,4,6,3]
    [4,4,5,3]
    [4,4,4,4]

    is this path wrong?


  • 0

    Your first step is wrong. We are asked to pass the dress at the same time. Since the 2nd washing machine has no dress in your first move, you cannot move dress from 2nd to 1st after the 2nd receiving one dress from 3rd, but counting them at the same move.


  • 0

    @zyjdxtc Your first step is incorrect. A dress can be moved to an adjacent washing machine only.


  • 0
    Z

    @fallcreek
    But the first step is exactly the same as the example in problem description.

    Input: [0,0,2,2]
    
    Output: 1
    
    Explanation: 
    1st move:     -->  0     0 <-- 2     2    =>    1     1     1     1
                 |_ _ _ _ _ _ _ _ _ _ _ _|
    

  • 1

    Hi @zzwcsong,

    Truly sorry for the misunderstanding and trouble.

    The problem description has been changed at the beginning of the contest (around 2 minutes),

    Though we have added a notice during the contest, it seems that your example and answer belongs to the original-wrong problem description.


  • 0
    Z

    @love_FDU_llp I see, it seems like I saw the old cached page


  • 0

    Hi @zzwcsong,

    Truly sorry for the trouble, we'll make the notice more real-time & Ajax in the future.

    Best,
    Chen


  • 0
    Z

    @dettier now I see the machines has been changed into a line ... I tried to solve it as a circle for the as the cache problem


  • 0
    A

    @love_FDU_llp GG me. Loaded up all the problems when the contest started so never got the circle -> line change :(


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.