← All problemsSign in

Subword Identification Problem

Let $A$ = {$a_1,$ $a_2,$ $\cdots$ $, a_8$} be an alphabet and $w$ = $b_1b_2$ $\cdots$ $b_n$ be a string over A where each $b_i$ ∈ $A$ (1 $\leq i \leq n$). Furthermore, $|w|$ ≤ 20. Now for 1 $\leq i \leq n$, we represent $\Theta(i)$ as the greatest integer, $j$ $\leq i$ $-$ 1 such that $b_1b_2 \cdots b_{j-1}$ = $b_{i-j+1} \cdots b_{i-1}$ and $b_i$ $\neq$ $b_j$ , i.e., $\Theta(i)$ = $max$ {$j$ | $j

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