Tap here to switch tabs
Problem
Submissions

Problem: Trionic Array II

Try to solve the Trionic Array II problem.

Statement

You are given an integer array nums of length n.

A subarray nums[l...r] is called trionic if there exist two indices p and q with 0≤0 \leq l << p << q << r << n such that:

  • nums[i] << nums[i + 11] for all l ≤\leq i << p

  • nums[i] >> nums[i + 11] for all p ≤\leq i << q

  • nums[i] << nums[i + 11] for all q ≤\leq i << r

Return the maximum possible sum of any trionic subarray in nums.

Constraints:

  • 4≤n=4 \leq n = nums.length ≤105\leq 10^5

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

  • It is guaranteed that at least one trionic subarray exists.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Trionic Array II

Try to solve the Trionic Array II problem.

Statement

You are given an integer array nums of length n.

A subarray nums[l...r] is called trionic if there exist two indices p and q with 0≤0 \leq l << p << q << r << n such that:

  • nums[i] << nums[i + 11] for all l ≤\leq i << p

  • nums[i] >> nums[i + 11] for all p ≤\leq i << q

  • nums[i] << nums[i + 11] for all q ≤\leq i << r

Return the maximum possible sum of any trionic subarray in nums.

Constraints:

  • 4≤n=4 \leq n = nums.length ≤105\leq 10^5

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

  • It is guaranteed that at least one trionic subarray exists.