← All problemsSign in

Valentine and Queries

Valentines is coming after Q days and Tappu desperately needs to impress his girlfriend Kannu. In order to test the extent of Tappu's love for her, Kannu gives Tappu a string S[1.....N] of length N . On the i th day of the Q days, she asks him about the number of substrings in the string S[Li...Ri] (both inclusive) which are same when read in forward as well as backward direction. (S[Li.....Ri]

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