Leetcode, Roman To Integer, Scala, Programming, Algorithms.
'V' -> 5, 'X' -> 10, 'L' -> 50, 'C' -> 100, 'D' -> 500, 'M' -> 1000 ) var sum = 0 // Initialize the total sum var prevValue = roman(s(0)) // Initialize the value of the first Roman numeral for (i <- 1 until s.length) { // Iterate from the second character to the end val currentValue = roman(s(i))