How to Solve '13 Roman to Integer' on LeetCode? - Javascript

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

Problem: #13 Roman to Integer
Language: #Javascript
Difficulty: Easy

Strategy: Case
Time Complexity: O(n)
Space Complexity: O(1)

1. Create sum variable.
2. Loop through s.
a. Create "prev" variable.
b. Create switch cases for each possible variable as a value.
3. Return sum.

Let's Connect 💯:
════════════════════════════
Рекомендации по теме
Комментарии
Автор

great pseudo code and explanation, with that pseudo I was able to click it, thanks!

theproactivemindset
Автор

While I was watching this video, I found my own solution wich is easier to read and code is more clean, but you gave me an idea))

fuga_eth
Автор

I'm so down and disappointed at myself for not being able to solve this "easy" problem. Just curious if you did this without prior knowledge about the problem or did you already know the answer and just explained your thought process?

json_n
Автор

good video !! i like the way you solved this problem without using a bunch of fancy jargon

bryantkeys
Автор

soo good and understandable, thx so much)

talenteds
Автор

bro here in first itration s[i-1] => s[-1] so, will it work?

irfanopc