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

Commit0d8c75a

Browse files
authored
Fixed Formatting 0002-add-two-numbers.dart
1 parentcb1effb commit0d8c75a

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

‎dart/0002-add-two-numbers.dart

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,34 @@
88
*/
99
classSolution {
1010
ListNode?addTwoNumbers(ListNode? l1,ListNode? l2) {
11-
ListNode?listnode;
11+
ListNode?listnode;
1212
int carry=0;
1313
while (l1!=null|| l2!=null) {
14-
int val=(l1?.val??0)+ (l2?.val??0)+carry;
15-
l1=l1?.next;
16-
l2=l2?.next;
17-
if(val>9){
18-
val=val-10;
19-
carry=1;
20-
}else{
14+
int val=(l1?.val??0)+ (l2?.val??0)+carry;
15+
l1=l1?.next;
16+
l2=l2?.next;
17+
if(val>9){
18+
val=val-10;
19+
carry=1;
20+
}else{
2121
carry=0;
2222
}
2323

24-
25-
print("val $val");
26-
27-
if(listnode!=null)
28-
listnode=ListNode(val,listnode);
24+
if (listnode!=null)
25+
listnode=ListNode(val, listnode);
2926

3027
else
3128
listnode=ListNode(val);
3229
}
33-
if(carry!=0){
34-
listnode=ListNode(carry,listnode);
30+
if(carry!=0){
31+
listnode=ListNode(carry,listnode);
3532
}
36-
var list;
37-
while(listnode!=null){
38-
list=ListNode(listnode.val,list);;
33+
var list;
34+
while(listnode!=null){
35+
list=ListNode(listnode.val,list);;
3936
listnode= listnode?.next;
4037
}
4138
return list;
4239
}
4340

44-
}
41+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp