Reaching Points

  • 0

    Click here to see the full article post

  • 0

    The true condition is missing in the Exhaustive Search method.

    if(sx == tx && sy == ty) return true;

  • 0

    @ssmru Thanks, corrected

  • 0

    Here's a more detailed explanation for tx != ty:

    • tx = ty implies that (tx-ty, ty) = (ty, ty) or (tx, tx-ty) = (tx, tx) or that they are the starting points
      • which implies that tx = 0 or ty = 0
      • here the problem states that sx and sy > 0, so it's not possible

    Aside from that, nice article !

  • 0

    approach 2 doesn't make any sense if there is no overlap sub-problems. can you give an example?

Log in to reply

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