Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Build a frequency map from magazine. Traverse ransomNote and decrement counts for needed letters. If any required letter count is unavailable, return false.
Every ransom letter must consume one matching magazine letter. Frequency tracking enforces one-to-one usage.
Updated Feb 2026