Ad
  • Default User Avatar

    It seems there is mistake in expected results for values (1,5) should be ("White", 9) not ("White", 10) because ...

    1. find point of meet: K_Pos + 2*i = P_Pos + i, where i - count of steps
    2. i = P_Pos - K_Pos
    3. Final_Pos = K_Pos + 2i or P_Pos + i
      Test for (1, 5): i = 4; Final_Pos = 1 + 2
      4 = 5 + 4 = 9
      Fix please, or explain what is wrong in my algorithm...