diff --git a/13. Roman to Integer b/13. Roman to Integer new file mode 100644 index 0000000..ac78974 --- /dev/null +++ b/13. Roman to Integer @@ -0,0 +1,34 @@ +class Solution { + public int romanToInt(String s) { + + HashMap map=new HashMap<>(); + map.put('I',1); + map.put('V',5); + map.put('X',10); + map.put('L',50); + map.put('C',100); + map.put('D',500); + map.put('M',1000); + + int sum=0; + for(int i=0;i=b){ + sum=sum+a; + } + else{ + sum=sum-a; + } + } + else{ + sum=sum+a; + } + } + return sum; + } +}