Reaching Points


  • 0

    Click here to see the full article post


  • 0
    S

    The true condition is missing in the Exhaustive Search method.

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

  • 0

    @ssmru Thanks, corrected


  • 0
    U

    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
    L

    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.