← All problemsSign in

Segments and String

Given $N$ strings $st[ ]$ of length $M$ each and an integer K. The strings $st[i]$ satisfy a very special property : - $st[i + 1][j]$ != $st[i][j + 1]$, for all $i$, $j$ where ($1 \leq i < n$) and ($1 \leq j < m$). You choose $N$ segments [$L_{i}, R_{i}$] such that: - $1 = L_{1} \leq R_{1} = L_{2} \leq R_{2} = L_{3} \leq R_{3} ..... R_{N - 1} = L_{N} \leq R_{N} \leq M$. - $R_{1} - L_{1

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