Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Anagram Testing Approach

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

Your question is Anagram Testing Approach. 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

Paddle Billing may need to compare two normalized text labels and determine whether they contain exactly the same characters. Given two lowercase English words, return whether one is an anagram of the other.

Two words are anagrams when they contain the same characters with the same frequencies, regardless of order. Each input contains only lowercase letters from a through z, so do not ignore spaces, punctuation, or letter case.

Formal Specification

Implement are_anagrams(word1, word2).

  • Input: Two strings, word1 and word2, containing lowercase English letters.
  • Output: Return True if the strings are anagrams, otherwise return False.

Constraints

  • 0 <= len(word1), len(word2) <= 10^5
  • Each character is a lowercase English letter
  • The input strings must not be modified

Function Signature

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