[Java] 13. Roman to Integer
문제 설명 : - 로마숫자가 문자열로 주어지고 이를 아라비아 숫자로 변환하는 문제 - 로마숫자의 예외케이스가 존재해서 예외처리만 해주면 되는 문제이다. import java.util.*; class Solution { public int romanToInt(String s) { //IV = 4, IX = 9 //XL = 40, XC = 90 //CD = 400, CM = 900 HashMap map = new HashMap(); int result = 0; 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); for(int i=0; i
2023. 6. 7.