// Time Complexity: O(N) minimum cost gets called with each index from 0 and N. Because of the memorization, each call takes O(1) time ...