← All problemsSign in

Sherlock and strings

Sherlock and Watson are playing a game involving bit strings, i.e., strings consisting only of the digits `0` and `1`. Watson has challenged Sherlock to generate a bit string S of **N** characters S1 , S2, ..., S**N**. The string must obey each of **K** different constraints; each of these constraints is specified via three integers **Ai**, **Bi**, and **Ci**. The number of `1`s in the substring S

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