Задача: https://leetcode.com/problems/jump-game-ii/description/> my code:
>
> .
Код: Выделить всё
class Solution {
public static ArrayList list = new ArrayList();
public int jump(int[] nums) {
dfs(nums, 0, 0);
int minStepsToFinish = list.stream().min(Integer::compare).get();
return minStepsToFinish;
}
public static void dfs(int[] nums, int current, int step) {
if(current == nums.length-1) {
list.add(step);
return;
}
step++;
for (int j = 1; j
Подробнее здесь: [url]https://stackoverflow.com/questions/77504753/i-cant-solve-a-task-on-leetcode-repeats-that-i-have-a-wrong-answer-and-i-tried[/url]