Available question text
Count the number of substrings of s that start and end with character c: simply count k = occurrences of c and return k*(k+1)/2 (choose two endpoints, allowing the same index), computable in a single O(n) scan for n up to 1e5.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3084. Count Substrings Starting and Ending with Given Character
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source