Solvarch
DSA ProblemsProgressPlanRoadmapsReviewCheat SheetsCompaniesSystem DesignCS FundamentalsQuestion Bank
Theme
Problems

Valid Anagram

Easy
stringhash-tablesorting

Given two strings s and t, return true if t is an anagram of s (same characters with the same frequencies), otherwise false.

Input: line 1 is s, line 2 is t. Output: true or false.

Example 1
Input:
anagram
nagaram
Output:
true
Example 2
Input:
rat
car
Output:
false

Constraints

  • 1 ≤ s.length, t.length ≤ 5·10^4
  • s and t consist of lowercase English letters.
Watch a video walkthrough

Run your code against the sample tests, or Submit to run the full suite.