Ad
  • Custom User Avatar

    Thanks I thought of it after asking the question lol. Just a minor adjustment from my previous thinking.

  • Custom User Avatar
  • Custom User Avatar

    armies can also move diagonally

  • Custom User Avatar

    For this test, goldMineRace([[1,6], [1,-4], [-4,1], [11,1], [4,5]],[1, 1, 1, 2, 1],[1, 1]),-1)
    I wonder whether the answer should be 4, the last city? Why? Well, I think the first four cities' armies arrive at the same time, so they wipe each other out; then the last city, index 4, arrives and gets the gold mine.
    city[0] has to go 5 at a speed of 1
    city[1] has to go 5 at a speed of 1
    city[2] has to go 5 at a speed of 1
    city[3] has to go 10 at a speed of 2
    city[4] has to go 7 at a speed of 1, so it arrives last, but alone. What am I missing here?

  • Custom User Avatar

    goldMineRace([[1,6], [1,-4], [-4,1], [11,1], [4,5]],[1, 1, 1, 2, 1],[1, 1])

    How come the result of this is supposed to be -1? The first 4 cities arrive at the same time so they all lose out, leaving the last city, which arrives the slowest to win it. Am I understanding the problem wrongly somehow?