← All problemsSign in

Exponential Sub-Palindromes

CodeChefRating 2442Open on judge ↗

You are given a binary string S of N bits. The bits in the string are indexed starting from 1. S[i] denotes the ith bit of S. Let's say that a sequence i1, i2, …, iK(1 ≤ K; 1 ≤ i1 i2 iK ≤ N) produces a palindrome when applied to S, if the string S[i1] S[i2] … S[ik] is a palindrome (that is, reads the same backward or forward). In addition, a sequence i1, i2, …, iK(1 ≤ K; 1 ≤ i1 i2 iK ≤ N)

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