Question bank › Two Pointers
Dsa Two Pointers Warm-up

Find All Distinct Substrings with Length K

Given a string and an integer K, find all distinct substrings of length K. Return a list containing these substrings in the order they first appeared. Example: Input: "banana", K = 3 Output: ["ban", "ana", "nan"] (This finds all unique substrings of length 3)

Key concepts

two_pointerssubstringsdistinct

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.