Tap here to switch tabs
Problem
Submissions

Problem: Jump Game IX

Try to solve the Jump Game IX problem.

Statement

You are given a 00 indexed integer array nums.

Starting at an index i, you can jump to another index j if and only if one of the following conditions is satisfied:

  • j<ij < i and nums[j] >> nums[i]

  • j>ij > i and nums[j] << nums[i]

You can perform any number of jumps.

Return an array ans of the same length as nums, where ans[i] represents the maximum value in nums that can be reached starting from index i.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Jump Game IX

Try to solve the Jump Game IX problem.

Statement

You are given a 00 indexed integer array nums.

Starting at an index i, you can jump to another index j if and only if one of the following conditions is satisfied:

  • j<ij < i and nums[j] >> nums[i]

  • j>ij > i and nums[j] << nums[i]

You can perform any number of jumps.

Return an array ans of the same length as nums, where ans[i] represents the maximum value in nums that can be reached starting from index i.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9