Question bank › Sliding Window
Dsa Sliding Window Warm-up

Count Anagrams in String

Given a string s and an integer k, return the count of substrings of length k that are anagrams of each other. Input format: - A single line containing the string s (1 <= |s| <= 100). - The second line contains an integer k (1 <= k <= |s|). Output format: - Print a single integer, the count of anagrammatic substrings of length k. Example: Input: abcaabc 2 Output: 6

Key concepts

sliding_windowhashmapsstrings

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.