Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9cdeb12

Browse files
authored
Update 12. Integer to Roman.md
for condition changed i<n.length
1 parent4ea4941 commit9cdeb12

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎leetcode/12. Integer to Roman.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ M 1000
7474
String[] roman= {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
7575
int[] n= {1000,900,500,400,100,90,50,40,10,9,5,4,1};
7676
StringBuilder sb=newStringBuilder();
77-
for(int i=0;num!=0; i++){
77+
for(int i=0;i<n.lenght; i++){
7878
while(num>= n[i]){
7979
num-= n[i];
8080
sb.append(roman[i]);
@@ -104,4 +104,4 @@ M 1000
104104
return sb.toString();
105105
}
106106
}
107-
```
107+
```

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp