Roman to Integer (LeetCode 13): Interview Notes

Roman numerals are written largest to smallest left to right, except six subtractive pairs (IV, IX, XL, XC, CD, CM).

Scan left to right: if the current value is less than the next, subtract it; otherwise add it. One pass is enough.

Time O(n), space O(1). Interviewers often ask you to invert the problem next (integer to Roman).

When you want live practice with follow-ups, try Linkjob AI.

Disclosure: I work on Linkjob AI.