You are given a nums.
Starting at an index i, you can jump to another index j if and only if one of the following conditions is satisfied:
nums[j] nums[i]
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:
nums.length
nums[i]
You are given a nums.
Starting at an index i, you can jump to another index j if and only if one of the following conditions is satisfied:
nums[j] nums[i]
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:
nums.length
nums[i]