My Vault

Home

❯

leetcode

❯

anagram
Properties1
tagscse/algorithm, leetcode

Jun 23, 20241 min read

Valid Anagram

  • https://leetcode.com/problems/valid-anagram/
  • An alternative is group-anagram [[]]
  • group-anagram

Solutions

  • Sort the strings then compare
  • Use dictionary with default values (defaultdict(int) in Python), then iterate through the values. Efficient in memory.
  • Use array, similar, most efficient in terms of memory.

Graph View

  • Valid Anagram
  • Solutions

Backlinks

  • group-anagram

Created with Quartz v5.0.0 © 2026

  • GitHub
  • Discord Community