Visit Them All
You are given a binary string $S$ of length $N$. Let $G$ be a complete directed graph of $N$ vertices numbered from $1$ to $N$. There is a directed edge going from vertex $u$ to $v$ if one of the following is true: - $S_u = S_v$ and $u v$ For example, if $S = 1010$ then $G$ looks like this: You will be given $Q$ queries of two different types: - $1$ $L$ $R$ - Flip all the bits in $S$ in range $
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.
Sign in to chat with the tutor and save your progress.
Sign in to start