leetcode.com/problems/min-cost-climbing-stairs/
Min Cost Climbing Stairs - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
746. Min Cost Climbing Stairs
class Solution { public int minCostClimbingStairs(int[] cost) { int f1 = 0, f2 = 0; for(int i = cost.length - 1; i >= 0; --i) { int f0 = cost[i] + Math.min(f1, f2); f2 = f1; f1 = f0; } return Math.min(f1, f2); } }
DP는 풀고 이틀후에 복습이 꼭 필요한거같다.. 정말 체화될때 까지는..