Hey! My name is Tomas. Thanks for checking out my channel.
LeetCode 242. Valid Anagram: https://leetcode.com/problems/valid-anagram/
Solution: https://github.com/R-Tomas-Gonzalez/github/tree/main/0242-valid-anagram
Step 1: Check lengths of both strings
Step 2: Create a map to keep track of letters
Step 3: Add letter amounts to map for first string
Step 4: Subtract letter amounts from map for second string
Answer: If there is more of an amount for a certain letter in the second string, return false. If it gets through both loops, return true.
• Connect with me on LinkedIn: https://www.linkedin.com/in/rtomasgonzalez/
Happy Coding!
Download
0 formats
No download links available.
How I solved Leetcode 242. Valid Anagram in JavaScript | NatokHD