Minimum Manhattan Distance Between 'X' and 'Y' in Matrix

Easyglean

Given a 2D string matrix containing only the characters 'X', 'O', and 'Y'. Calculate the minimum Manhattan distance between any 'X' and 'Y'.

Input: A character matrix, e.g., [['XOO', 'OOY', 'OOY']] O...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: