How to Solve "Alternating Characters" on HackerRank? - Javascript Strings

Опубликовано: 05 Октябрь 2024
на канале: Coding David
333
8

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

How to Solve "Alternating Characters" on HackerRank?

Category: Strings
Problem: Alternating Characters
Language: Javascript
Difficulty: Easy

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