DP
function fib(n) a = 1, b = 1; if (n == 1 || n == 2) return 1; for i = 3 to n c = a + b; a = b; b = c; return c; iterative function fib(n) if (n == 1 || n == 2) return 1; else return fib(n-1) + fib(n-2); What’s the time complexity? T(n) = T(n-1) + T(n-2) + 1 minimum cost between stations int cost[N][N] = { {0, 10, 75, 94}, {-1, 0, 35, 50}, {-1, -1, 0, 80}, {-1, -1, -1, 0} }; minCost(0, N-1) = MI..
2023. 6. 11.