Welcome to The Mirror of Galadriel, one of the activities that will follow in the The Fellowship of Code. If you haven't been here before, this is a place where programming problems of different types will be proposed to be solved as fast as possible.
Without further ado, we leave you with the next problem.
Good luck adventurers!
Given two strings s
and t
, return true
if t
is an anagram of s
, and false
otherwise.
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
Constraints
1 <= s.length, t.length <= 5 * 10^4
s
andt
consist of lowercase English letters.
Example 1
Input: s = "anagram", t = "nagaram"
Output: true
Example 2
Input: s = "rat", t = "car"
Output: false
Here you can find the spice if you want to show off, with a slightly more difficult challenge.
- What if the inputs contain Unicode characters? How would you adapt your solution to such a case?
This exercise has been extracted from the LeetCode website. Don't hesitate, join and practice in this great community.