Leetcode, Roman To Integer, Scala, Programming, Algorithms.
// Get the integer value of the current Roman numeral from the map // If the current value is greater than the previous value, subtract the previous value // Otherwise, add the previous value to the sum sum += (if (currentValue > prevValue) -prevValue else prevValue) prevValue = currentValue //