Available question text
Count the number of substrings in a given string whose first and last character are the same. This reduces to aggregating contributions per character (single-character substrings plus pairs of equal endpoints) so you can compute the answer in linear time using frequency counts.
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 2955. Number of Same-End Substrings
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source