a
n
a
g
r
a
m
[0][1][2][3][4][5][6]
t = "nagaram"
n
a
g
a
r
a
m
[0][1][2][3][4][5][6]
Brute force · sort
▸1// t anagram of s?2return sorted(s) == sorted(t)
state
warming up the animation
Given two strings s and t, return true if t is an anagram of s (a rearrangement using all the original letters exactly once).
▸1// t anagram of s?2return sorted(s) == sorted(t)
line 1t is an anagram of s if they use the exact same letters with the same counts. s = "anagram", t = "nagaram".