← All problemsSign in

Prime in a binary string

CodeChefRating 1473Open on judge ↗

You are given a binary string $S$ of length $N$. Your task is to check if there exists a [substring](https://en.wikipedia.org/wiki/Substring) of $S$ which is the binary representation of a [prime number](https://en.wikipedia.org/wiki/Prime_number). Formally, check if there exist integers $L$ and $R$ such that $1 \leq L \leq R \leq N$, and the substring $S_L S_{L+1} S_{L+2} \ldots S_R$, when treat

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