Triplets of the Court
CodeChefOpen on judge ↗
Akbar is ready with another puzzle for Birbal. Given a set of strings , each of which is the first name of one of Akbar's courtier, he wants Birbal to count the number of ordered triplets of strings , where SN1, SN2 and SN3 are non-empty substrings of N1, N2 and N3 respectively. The three substrings should be such that SN1+SN2+SN3 should form a palindrome. (Note: here '+' denotes the concatenation
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.
Sign in to chat with the tutor and save your progress.
Sign in to start