Link: https://leetcode.com/problems/integer-to-roman/
Solution:
Topics: math, Roman to integer
Intuition
There is really not much to this problem if you know how roman numerals work. Basically the process of converting integer to roman is subtractive. Roman numerals each have some value, and the next roman numeral for a particular number will be the numeral with the largest value that can be taken subtracted from the current number…then we subtract it, append the numeral and repeat the process.
This is the reverse of the process used in Roman to integer. There, we used addition to add the current numeral’s numerical value to the result…or the current and the next numeral in the case of the doubles (900 = CM)
Implementation
Review 1
Not much to add. Easy. Remember to hard code the edge cases (4,9,40,90,400,900)