Another almost Easy #LeetCode Medium today. 

DFS with Caching.  

O(m+n) worst case and O(1) amortized time complexity. O(n) space complexity.  

#LeetCode #ProblemOfTheDay #POTD #DSA #ProblemSolving #cplusplus #potd
#LeetCode #LeetCode #ProblemOfTheDay #POTD #DSA #ProblemSolving #cplusplus #potd