Question bank › Strings
Dsa Strings Hard

K-Length Reversed Substrings

Given a string and an integer k, generate all unique substrings of length k and return them in reversed order. If k is greater than the length of the string, return an empty list. Input Format: A string followed by an integer k on the next line. Output Format: A space-separated string containing the unique reversed substrings of length k, or an empty string if no such substrings exist. Example: Input: hello 3 Output: oll ehh Explanation: The unique substrings of length 3 are 'hel', 'ell', 'llo'. Reversing them gives 'leh', 'lle', 'oll'. Unique values combined and sorted to give 'oll ehh'.

Key concepts

stringssubstringsreversal

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 Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.