← All problemsSign in

No Palindrome

CodeChefRating 2054Open on judge ↗

Given positive integers $N$ and $K$, let $S$ denote the **smallest number** of $N$ digits (with no leading zeros) such that: - No substring of $S$ having length **strictly greater** than $K$ is a [palindrome](https://en.wikipedia.org/wiki/Palindrome#Numbers). Find the **sum of digits** of $S$. Note: - A substring of a number is obtained by deleting some (possibly zero) digits from the beginning

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