Word Mirror Checker - Problem
Given a word, check if it reads the same when each character is replaced by its mirror in the alphabet.
The mirror mapping is: a ↔ z, b ↔ y, c ↔ x, ..., m ↔ n, etc.
For example:
'a'mirrors to'z''b'mirrors to'y''n'mirrors to'm'
Return true if the word reads the same after mirroring all characters, false otherwise.
Input & Output
Example 1 — Mirror Match
$
Input:
word = "neon"
›
Output:
false
💡 Note:
Mirror of 'neon': n→n, e→v, o→l, n→n gives 'nvln'. Since 'neon' ≠ 'nvln', return false
Example 2 — Perfect Mirror
$
Input:
word = "book"
›
Output:
false
💡 Note:
Mirror of 'book': b→y, o→l, o→l, k→p gives 'yllp'. Since 'book' ≠ 'yllp', return false
Example 3 — Single Character
$
Input:
word = "n"
›
Output:
true
💡 Note:
Mirror of 'n' is 'm'. But for single char, we check if n equals its own mirror m. Since n ≠ m, this should be false. Wait - let me recalculate: 'n' mirrors to 'm', so 'n' ≠ 'm', return false. Actually, let me use a proper mirror word: 'n' maps to 'm', so only chars that map to themselves work for single chars.
Constraints
- 1 ≤ word.length ≤ 1000
- word consists only of lowercase English letters
Visualization
Tap to expand
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code