codes are distinct. Two codes form a **mirror pair** if one of them is the other read backwards (for example, "ab" and "ba").
Each code can be in at most one pair. Return the largest number of mirror pairs you can form.codes=['ko', 'pt', 'ok', 'mm', 'tp'] → 2
The pairs are "ko" with "ok" and "pt" with "tp". "mm" reads the same both ways, but there is no second copy, since all codes are distinct.
codes=['ab', 'bc', 'ca'] → 0
No code is another one reversed.
codes=['ko', 'pt', 'ok', 'mm', 'tp']
2
Run checks the first 3 tests in your browser. Submit checks all 41 tests on the server, hidden ones included.