How to Solve "First Unique Character In A String" ? - LeetCode 387 Javascript

Опубликовано: 20 Январь 2021
на канале: Coding David
118
0

How to Solve "First Unique Character In A String" on LeetCode?

Problem: #387 First Unique Character in a String

Difficulty: Easy

Language: #javascript

Time Complexity: O(n)

Space Complexity: O(n)

Pseudo Code:

1. Create object "characterCount".

2. Loop through s.

a. Create condition to see if the current character in "s" is in the "characterCount". If not, add the key of current character and a value of 1.

b. Create condition if it the current character in "s" is in the "characterCount", we increment value by 1.

3. Loop through s.

a. Create condition to see if the value of that current character in the "characterCount" is equal to one. Return the i.

4. Return -1

Do you need more help with coding?
════════════════════════════
✅ Schedule a FREE 30 minute tutoring session with me.
https://calendly.com/anusontarangkul/...

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


На этой странице сайта вы можете посмотреть видео онлайн How to Solve "First Unique Character In A String" ? - LeetCode 387 Javascript длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Coding David 20 Январь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 118 раз и оно понравилось 0 зрителям. Приятного просмотра!