Valid Anagram
Easy · Hash Table, String, Sorting
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
Example 1
Input: s = "anagram", t = "nagaram" Output: true
Example 2
Input: s = "rat", t = "car" Output: false
Constraints
- 1 <= s.length, t.length <= 5 * 104
- s and t consist of lowercase English letters.
Starter code (python)
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
Related problems
- Two Sum (Easy)
- Longest Substring Without Repeating Characters (Medium)
- Longest Palindromic Substring (Medium)
Previous: Different Ways to Add Parentheses · Next: Binary Tree Paths · All problems
Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.