package
0.0.0-20241220224003-b7cf03a90b2b
Repository: https://github.com/szhou12/leetcode-go.git
Documentation: pkg.go.dev

# README

383. Ransom Note

Solution idea

  • 用 HashMap 统计 magazine中每个字母出现的个数,然后在看够不够ransomNote来使用

  • 思路和 349. Intersection of Two Arrays 一致

  • 优化: 用长度为26的数组 而不是 HashMap 来统计

Time complexity = $O(n)$