Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Check Anagram Using Built-Ins

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Check Anagram Using Built-Ins. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

A GlobalLogic code-review utility needs to verify whether two submitted strings contain exactly the same characters with the same frequencies. Implement a function that determines whether the strings are anagrams using Python built-in functions.

Two strings are anagrams if one can be rearranged to form the other. Treat uppercase and lowercase letters as different characters, and do not ignore spaces or punctuation.

Formal Specification

Implement are_anagrams(s, t), where s and t are strings. Return True if they contain identical characters with identical frequencies, regardless of order. Otherwise, return False.

Constraints

  • 0 <= len(s), len(t) <= 10^5
  • Inputs may contain Unicode characters, spaces, and punctuation
  • Matching is case-sensitive
  • Return a boolean value

Function Signature

def are_anagrams(s, t):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output