Leetcode, Roman To Integer, Scala, Programming, Algorithms.
Solution { def romanToInt(s: String): Int = { var sum = 0 var prevValue = 0 val value = Map( 'I' -> 1, 'V' -> 5, 'X' -> 10, 'L' -> 50, 'C' -> 100, 'D' -> 500, 'M' -> 1000 ) for (c <- s) { val currentValue = value(c) sum += (if (currentValue > prevValue) currentValue - 2 * prevValue else