← All problemsSign in

Devu and good strings

CodeChefRating 2351Open on judge ↗

A string str is called a good string if there does not exist three difference indices i, j, k such that i, j, k are consecutive three terms of an arithmetic progression and str[i] = str[j] = str[k]. You are given a string s and two integers K, A. You have to find the number of good strings t with alphabet size A (i.e. if A = 1, then string can only have a's and if A = 2, string can only contain '

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