← All problemsSign in

Odd Strings

CodeChefRating 2592Open on judge ↗

You are given two integers $N$ and $K$. Construct any binary string $S$ of length $N$ such that exactly $K$ of its **odd-length** substrings have mode equal to $1$. If no such string exists, print $-1$. ---- **Note:** The *mode* of a string is the character that appears in it the most number of times. For a binary string of odd length, the mode is always uniquely $0$ or $1$. ### Input - The fi

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