Question bank › Two Pointers
Dsa Two Pointers Warm-up

Letter Swapper

As part of a simple encryption step, you need to reverse only the alphabetic characters in a string while keeping all digits and special symbols in their original fixed positions. Input Format: A single string of characters. Output Format: The modified string where only letters are reversed. Example: Input: a-b1c Output: c-b1a (Explanation: 'a', 'b', and 'c' are reversed to 'c', 'b', 'a', but '-' and '1' stay at indices 1 and 3.)

Key concepts

two_pointersstring_processing

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.