로딩
요청 처리 중입니다...

JAVA_Roman to Integer_LeetCode 13

 JAVA_Roman to Integer_LeetCode 13

JAVA_Roman to Integer_LeetCode 13 Roman to Integer 풀이 class Solution { public int romanToInt(String s) { if (s == null || s.length() == 0){ return -1; } 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 len = s.length(); int res = map.get(s.charAt(len - 1)); for (int i = len - 2; i >= 0; i--) { if (map.get(s.charAt(i)) >= map.get(s.charAt(i + 1)))...

# JAVA # JAVA_LeetCode13 # JAVA_RomantoInteger # JAVA_RomantoInteger_LeetCode13 # RomantoInteger_LeetCode13