How to Solve "Two Strings" on HackerRank? - Javascript Hashmaps

Опубликовано: 21 Октябрь 2024
на канале: Coding David
552
6

Do you need more help with coding?
════════════════════════════
✅ Apply for 1-1 coaching https://form.jotform.com/230156286763056
════════════════════════════

How to Solve "Two Strings" on HackerRank?

Problem: Two Strings
Category: Hashmaps
Difficulty: Easy
Language: Javascript

Time Complexity: O(n+m)
Space Complexity: O(n)

Pseudo Code:
1. Create map object.
2. Loop through s1.
a. Set each character in s1 to true.
3. Loop through s2.
a. Create condition if the character is in the map.
i. Return "YES".
4. Return "NO".

Let's Connect 💯:
════════════════════════════
LinkedIn:   / anusontarangkul  
TikTok:   / david.anu_  
Instagram:   / david.anu_  
GitHub: https://github.com/anusontarangkul