https://github.com/careercup/ctci/blob/master/java/Chapter%209/Question9_2/QuestionDP.java#L39
Using the cache (dynamic programming) doesn't help in this case, where you are only looking for the first working path. Only the first working path can have any partial results to be saved.
It would, however, help in the case where you want to find all paths.
https://github.com/careercup/ctci/blob/master/java/Chapter%209/Question9_2/QuestionDP.java#L39
Using the cache (dynamic programming) doesn't help in this case, where you are only looking for the first working path. Only the first working path can have any partial results to be saved.
It would, however, help in the case where you want to find all paths.