* All the elements in forbidden are distinct. * Position x is not forbidden. * */ pub struct Solution {}// problem: https://leetcode.com/problems/minimum-jumps-to-reach-home/ // discuss: https://leetcode.com/problems/minimum-jumps-to-reach-home/discuss/?currentPage=1&orderBy=most_vot...
1classSolution {2public:3intminimumJumps(vector<int>& forbidden,inta,intb,intx) {4//state: last try type:1:forward, 0:backward5//pos6//if try_type == forward(1): next can try both forward(1) and backward(0)7//if try_type == backward(0): next can try only forward(1)8//if...
花花酱 LeetCode 2771. Longest Non-decreasing Subarray From Two Arrays 花花酱 LeetCode 2770. Maximum Number of Jumps to Reach the Last Index 花花酱 LeetCode 2435. Paths in Matrix Whose Sum Is Divisible by K 花花酱 LeetCode 2420. Find All Good Indices 花花酱 LeetCode 2407. Longest Increasin...