You’re interviewing for a backend or data engineering role at a FAANG-level company. The interviewer describes a real product scenario:
A large platform processes text-based identifiers such as usernames, search queries, tags, or document keys.
To detect duplicates, spam, or content variations, the system sometimes needs to verify whether two strings are composed of the same characters with the same frequencies, even if the order of characters is different.
These two strings are stored as s and t.
The platform wants a fast and reliable way to check whether one string is an anagram of the other.
This is a common practice coding problem for DSA question might ask in Google, Amazon, Netflix, Meta, Apple, Microsoft, Uber, and Bloomberg interviews.
Your Task
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
An anagram uses the same characters with the same frequencies, but possibly in a different order.
Input Format
Output Format
- A boolean value:
true if t is an anagram of sfalse otherwise