My Vault

Home

❯

leetcode

❯

anagram

anagram

Jun 23, 20241 min read

  • cse/algorithm
  • leetcode

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 v4.5.2 © 2026

  • GitHub
  • Homepage