Question bank › Two Pointers
Dsa Two Pointers Hard

String Anagram Formation

You are given two strings, s1 and s2. Your task is to determine if any anagram of s1 can be formed using a continuous substring of s2. Implement a function that reads from standard input and outputs 'Yes' if such a substring exists, otherwise 'No'. Example: Input: abc dcbad Output: Yes Input Description: The first line contains string s1 (1 ≤ |s1| ≤ 100) and the second line contains string s2 (1 ≤ |s2| ≤ 100).

Key concepts

two_pointersstringsanagrams

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.