Question bank › Strings
Dsa Strings Medium

Mirror-Symmetric Substring

Given a set of mirror-pairs and a string, find the longest substring that is 'mirror-symmetric'. A string is mirror-symmetric if its reverse is equal to its mirrored version. For example, if 'b' mirrors 'd' and 'o' mirrors 'o', then 'bod' is mirror-symmetric (reverse 'dob', mirrored 'dob'). A single character can only be part of a symmetry if it is defined as mirroring itself or another character. Input format: Line 1: Space-separated pairs (e.g., 'bd pq oo') Line 2: The string to search Output: The longest mirror-symmetric substring. If multiple exist with the same length, return the one that appears first.

Key concepts

palindromemappingsubstrings

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.