Ad
  • Custom User Avatar

    Exactly as beautyistruth said, it works on closures and local loop scope.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Can you please explain why does it work so?

  • Custom User Avatar

    I solved this based on your description but some of the random tests are giving data that violates one of the tenants of the problem. I'm getting rows that are different lengths or entirely empty arrays as the expected outcome of the test.

    e.g.

    Expected: [
                ["O","O","O","O","O","O","O","O","O","O"],
                ["O","O","O","O","O","O","O","O","O","O"],
                ["O","O","O","A","A","A","A","A","A","A"],
                ["A","A","A","A","A","A","A","A","A","A"],
                ["A","A","A","A","A","A","A","W","W","W"],
                ["W","W","W","W","W","W","W","W","W","W"],
                ["W","W","W","W","W","H","H","H","H","H"],
                ["H","H","H","H","H","H","H","H","H","H"],
                ["H","H","H","H","H","H","H"],
                []
                ], 
    instead got: [
                ["O","O","O","O","O","O","O","O","O","O"],
                ["O","O","O","O","O","O","O","O","O","O"],
                ["O","O","O","A","A","A","A","A","A","A"],
                ["A","A","A","A","A","A","A","A","A","A"],
                ["A","A","A","A","A","A","A","W","W","W"],
                ["W","W","W","W","W","W","W","W","W","W"],
                ["W","W","W","W","W","H","H","H","H","H"],
                ["H","H","H","H","H","H","H","H","H","H"],
                ["H","H","H","H","H","H","H",null,null,null],
                [null,null,null,null,null,null,null,null,null,null]
                ]
    

    "The width of the glass will not change from top to bottom."