Tap here to switch tabs
Problem
Submissions

Problem: First Matching Character From Both Ends

med
30 min
Try to solve the First Matching Character From Both Ends problem.

Statement

Given a string s of length n, find the smallest index i such that s[i] is equal to s[n - 1 - i].

Return the minimum valid index i. If no such index exists, return −1-1.

Constraints:

  • 1≤n==1 \leq n == s.length ≤100\leq 100

  • s consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: First Matching Character From Both Ends

med
30 min
Try to solve the First Matching Character From Both Ends problem.

Statement

Given a string s of length n, find the smallest index i such that s[i] is equal to s[n - 1 - i].

Return the minimum valid index i. If no such index exists, return −1-1.

Constraints:

  • 1≤n==1 \leq n == s.length ≤100\leq 100

  • s consists of lowercase English letters.