Leetcode, Roman To Integer, Scala, Programming, Algorithms.
each character in the string val currentValue = value(c) // Get the integer value of the current Roman numeral // If the current value is greater than the previous value, subtract twice the previous value // Otherwise, add the current value to the sum sum += (if (currentValue > prevValue)