← All problemsSign in

Break This Array

CodeChefRating 2722Open on judge ↗

You are given an array $A$ of size $N$, and a string $S$ of length $K$ consisting of characters $\texttt{L}$ and $\texttt{R}$ only. You have to perform $K$ operations on the array. In the $i^{th}$ operation: - If the array is of size $1$, you do not need to perform the operation. - Else, choose an integer $X$ $(1\le X \lt |A|)$ randomly and equi-probably and break the array $A$ into subarrays $A[

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