Home
Log in
DescriptionSubmissionsSolution
DescriptionSubmissionsSolution
Loading...

Log in to run or submit

s =
t =

Codey

Practise coding problems, test your solutions and track your progress.

Explore

  • Problems
  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

© 2026 Codey. Personal learning project.

Solution
Updated: 2026-02-23

Idea

Two strings are anagrams if they have the same character counts.

Approach

If lengths differ, return false. Otherwise count characters in both strings and compare the counts.

Why it works

Anagrams have identical frequency for every character; comparing frequency maps exactly captures this condition.

Code
Loading...
Complexity
Time: O(n)
Space: O(1)
Solution
Updated: 2026-02-23

Idea

Two strings are anagrams if they have the same character counts.

Approach

If lengths differ, return false. Otherwise count characters in both strings and compare the counts.

Why it works

Anagrams have identical frequency for every character; comparing frequency maps exactly captures this condition.

Code
Loading...
Complexity
Time: O(n)
Space: O(1)