← Paytm questions

Minimum distance between two given characters of a string

Filed under Paytm

Given a string `s` and two characters `c1` and `c2`, find the minimum distance (in terms of index difference) between occurrences of `c1` and `c2` in the string.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Paytm questions

Collected from public candidate posts and coding forums. Updated Nov 2026.