Every day a Leetcode
题目来源:45. 跳跃游戏 II
解法1:动态规划 贪心
定义 dp[i] 表示到达 i 的最少跳数。
因为题目保证能跳动终点,只要前面的点(j < i)能跳到 i 点就更新最小值。
代码:
class…
A. Find Minimum Operations
Problem Statement
You are given two integers n n n and k k k.
In one operation, you can subtract any power of k k k from n n n. Formally, in one operation, you can replace n n n by ( n − k x ) (n-k^x) (n−kx) for any no…