Leetcode, Roman To Integer, Scala, Programming, Algorithms.
input and a few auxiliary variables (sum, prevValue, and the small fixed-size map for the Roman numeral values), no additional space that scales with input size is used. The map does not grow with the size of the input string since the number of Roman numeral symbols is constant and limited to