Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
Backend Engineer Senior programming

Design a function to verify if two strings are anagrams of each other. An anagram is a rearrangement of letters of the first string to form the second. Please implement the following function:


def areAnagrams(s: str, t: str) -> bool:

Constraints:


  • 0 <= s.length, t.length <= 50

  • Both strings consist of lowercase English letters.


Example 1:


Input: s = "listen", t = "silent"
Output: true

Example 2:


Input: s = "rat", t = "car"
Output: false
Suggested Answer

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free
Link copied to clipboard