Problem:
Given two strings s and t , write a function to determine if t is an anagram of s.
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Example 2:
Input: s = "rat", t = "car"
Output: false
Note:
You may assume the string contains only lowercase alphabets.
-Summary-
1. Create two python dictionary to count each character in the string 's' and 't'.
2. If two dictionary is the same after counting each character in the string, it will return True. Otherwise, return False

정답을 보니, sorting 해서 푸는 방법도 있었다.

모든 문제에 대한 저작권은 LeetCode 회사에 있습니다. [Copyright © 2020 LeetCode]
'LeetCode > Top Interview Q. - Easy' 카테고리의 다른 글
LeetCode. String to Integer (atoi) [String] (0) | 2020.06.02 |
---|---|
LeetCode. Valid Palindrome [String] (0) | 2020.06.01 |
LeetCode 387. First Unique Character in a String (0) | 2020.05.25 |
LeetCode 7. Reverse Integer (0) | 2020.05.25 |
LeetCode 350. Intersection of Two Arrays II (0) | 2020.05.24 |
댓글