Shortest Distance Between 'X' and 'Y' in String
Asked at Glean · Coding Questions · Difficulty: Easy
Given a string containing only the characters `'X'`, `'O'`, and `'Y'`, find the shortest distance between any `'X'` and any `'Y'`. The distance is the difference of their indices in the string.
Loading the problem…