How to Solve '1704 Determine if String Halves Are Alike' on LeetCode - Javascript

preview_player
Показать описание
Do you need more help with coding?
════════════════════════════
════════════════════════════

Problem: #1704 Determine if String Halves Are Alike
Difficulty: Easy
Language: Javascript

Strategy: Traverse string and compare to vowels object.
Time Complexity: O(n)
Space Complexity: O(1)

Pseudo Code:
1. Create a vowels object to hold the vowels.
2. Update s to be only lower case.
3. Create count variable.
4. Loop through the first half of s.
a. Create a condition if the current index value is inside the vowels object.
i. Increment the count.
5. Loop through the second half of s.
a. Create a condition if the current index value is inside the vowels object.
i. Decrement the count.
6. Return if count is equal to 0.

GitHub Repo:

Let's Connect 💯:
════════════════════════════
Рекомендации по теме
visit shbcf.ru