Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Problem 5: Ransom Note (easy)

Problem Statement

Given two strings, one representing a ransom note and the other representing the available letters from a magazine, determine if it's possible to construct the ransom note using only the letters from the magazine. Each letter from the magazine can be used only once.


  1. Example 1:

    • Input: Ransom Note = "hello", Magazine = "hellworld"
    • Expected Output: true
    • Justification: The word "hello" can be constructed from the letters in "hellworld".
  2. Example 2:

    • Input: Ransom Note = "notes", Magazine = "stoned"




Like the course? Get enrolled and start learning!