Ad
  • Custom User Avatar

    In this case after one step the closest people to come in contact will appear like this "><". According to the first example if there is a position like this they will come into contact after one step. So that gives you an answer of 2 steps.

  • Default User Avatar

    I didn't liked this problem at all..
    especially the one of the initial test case given is

    assertEquals(2, Hallway.contact(">-----<-->--<-----"));

    now if there are two -- how come expected is 2? that means we are talking about persons colliding each other only, and not just coming in contact.
    on two -- after taking one step each, both will come face-to-face, and as per the details, it should be taken as contact. so answer should be 1.
    This contradicted many times on random tests..for me.