🟩 Easy
My Solution
func canConstruct(ransomNote string, magazine string) bool { m := [26]int{} for _, c := range magazine { m[c-'a']++ } for _, c := range ransomNote { m[c-'a']-- if m[c-'a'] < 0 { return false } } return true }
Last updated 4 months ago
Was this helpful?
Leetcode: