Tap here to switch tabs
Problem
Submissions

Problem: Substrings That Begin and End With the Same Letter

Try to solve the Substrings That Begin and End With the Same Letter problem.

Statement

Given a string s, return the total number of substrings of s that begin and end with the same character.

A substring is a contiguous non empty sequence of characters within a string.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Substrings That Begin and End With the Same Letter

Try to solve the Substrings That Begin and End With the Same Letter problem.

Statement

Given a string s, return the total number of substrings of s that begin and end with the same character.

A substring is a contiguous non empty sequence of characters within a string.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists only of lowercase English letters.