package solutions.leetcode;

import static org.junit.Assert.assertEquals;

import base.Solution;

public class RomanToInteger extends Solution<String, Integer> {

    @Override
    protected Integer runTest(String input) {
        return this.romanToInt(input);
    }

    @Override
    protected void printOutputData(Integer output) {
        System.out.println(output);
    }

    @Override
    protected void testOutput(Integer outputTest, Integer output) {
        assertEquals(outputTest, output);
    }

    public int romanToInt(String s) {
        return 0;
    }
    
}

@@ -540,16 +540,19 @@
 ing s) %7B
+   
 %0A       
@@ -556,16 +556,784 @@
     
-return 0
+%0A        int strLen = s.length();%0A        if (strLen %3C 1) return 0;%0A        s = s + (char) 'B';%0A        /*%0A         * %0A         Char   I   V   X   L   C   D   M%0A         ASCII  73  86  88  76  67  68  77%0A         -'B'   6   19  21  9   0   1   10  // ASCII - 66%0A         Key    7   6   8   10  1   2   11  // %2514%0A         %0A         * */%0A        int%5B%5D sCharMap = new int%5B%5D%7B0, 100, 500, 0, 0, 0, 5, 1, 10, 0, 50, 1000%7D;%0A        int MVAL = 14;%0A        %0A        int res = sCharMap%5B(s.charAt(0) - 'B') %25 MVAL%5D;%0A        int preVal = res;%0A        %0A        %0A        for (int i = 1; i %3C strLen; i++) %7B%0A            int curVal= sCharMap%5B(s.charAt(i) - 'B') %25 MVAL%5D;%0A            res += curVal - (curVal %3E preVal ? preVal * 2 : 0);%0A            preVal = curVal;%0A        %7D%0A        return res
 ;%0A  

Roman to Integer