Daily challenge for 2026-08-24
601. Matching Ends Count
Given a string s, use a two-pointer approach to count how many matching pairs of characters exist at the corresponding positions from the beginning and the end of the string, moving inwards. Stop counting as soon as a mismatch is found or the pointers meet/cross.
Example:Input: s = "abcba"Output: 2
Explanation: The character at index 0 ('a') matches the character at index 4 ('a'). The character at index 1 ('b') matches the character at index 3 ('b'). The pointers then meet at index 2, so we stop. The total count of matching pairs is 2.
Run this challenge interactively in Python or JavaScript when the app loads.