Anagram Pairs Problem Statement

Determine if two given strings are anagram pairs. Two strings are anagrams if the letters of one can be rearranged to form the other.

Input:

The input consists of a single line containing two space-separated strings, Str1 and Str2.

Output:

The output is a single line containing either True or False. Return True if the strings are anagram pairs, otherwise return False.

Example:

Input:
str1 = "listen" str2 = "silent"
Output:
True
Explanation:

Because str1 and str2 contain the same characters with the same frequency, they are anagram pairs.

Constraints:

  • 1 ≤ N ≤ 105 where N is the length of str1
  • 1 ≤ M ≤ 105 where M is the length of str2
  • Time Limit: 1 second
  • The strings are only in lowercase characters.
Note:

The solution should be efficient enough to handle large inputs within the given time limit.

Be the first one to answer
Add answer anonymously...
Info Edge Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter