← Sprinklr questions

Count substrings starting and ending with the same character in range

Filed under Sprinklr

The question

Given a 1-indexed lowercase string and q queries with range [l, r], count the number of substrings within each range that start and end with the same character.

No write-up yet. Related questions below have one.

Related Sprinklr questions

Collected from public candidate posts and coding forums. Updated Nov 2026.