Algorithms Playbook
← All problems
EasyFrequency counting →Similar to: Valid Anagram

Same letters?

Problem

Given two strings s and t, return true if t is a rearrangement of the letters of s, using every letter exactly as many times.

Examples

Input: s = "listen", t = "silent"

Output: true

Input: s = "rat", t = "car"

Output: false

Hints

    Try it first. Every hint reveals a bit more.

    Solution