Another possible extension!


  • 0
    K

    Hello,
    What if we extend the problem by allowing moves up and left as well? I guess it is a simple extension and can be easily solved if you solved Unique Paths problems already.

    If there something I am missing (e.g. underestimating the difficulty of this extension), please let me know.


  • 0
    A

    @KareemErgawy There is no point for allowing traveling backwards, because there will be infinitely many paths.
    A simple example: a 1 x 3 grid. You can travel between [0,0] and [0,1] infinitely many times to your heart's content before reaching [0, 2].

    So, you have to add a contraint: a grid can't be visited twice in any path. But then that's not an easy problem at all.


Log in to reply
 

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