← All problemsSign in

You fall only once

You are given an array $A$ of size $N$. You have to find the number of ways to choose 4 indices : $l1$, $r1$, $l2$ ,$r2$ such that following conditions are satisfied : 1. $A_{l1}$, $A_{l1 + 1}$, ..., $A_{r1}$ is a sub-array of $A$ and $A_{l2}$, $A_{l2 + 1}$, ..., $A_{r2}$ is another non-overlapping sub-array of $A$. 2. $r1 = l2 - 1$ 3. If we concatenate both subarrays a new

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start