热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

(Java)LeetCode-13.RomantoInteger

Givenaromannumeral,convertittoaninteger.Inputisguaranteedtobewithinthera

Given a roman numeral, convert it to an integer.

Input is guaranteed to be within the range from 1 to 3999.



这一题和上一题姊妹题~同样的方法,反过来即可,easy~



public class Solution {
    public int romanToInt(String s) {
        int ans = 0;
		int[] aArray = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
	    String[] rArray = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
	    
	    for(int i = 0; i  
 





推荐阅读
author-avatar
情商是你弟
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有