Intuition
This problem is quite simple once you wrap your head around the logic. Basically, each letter in the roman numeral maps to a positive value UNLESS its followed by a larger letter…in that case the contribution of the letter is negative.
The last letter can never be negative because nothing follows it.
Implementation
Visual
Review 1
Pretty easy problem but I’m not a fan of the above implementation because it is not very generic as it relates to Integer to roman. Here is an alternate implementation that is basically the reverse of that problem: