File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12 Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,19 @@ public String gameResult(ListNode head) {
17
17
scores [head .val % 2 ]++;
18
18
// Gpt help ended at the line above
19
19
} else {
20
+ //else will only be applicable if the previous condition is false
20
21
scores [head .next .val % 2 ]++;
22
+ //increments score for the next node value
21
23
}
22
24
}
23
25
head = head .next ;
26
+ //reassigns the variable, head, to point to the next node in the list
24
27
}
25
28
if (scores [0 ] == scores [1 ]) {
29
+ //checks for a tie
26
30
return "Tie" ;
27
31
} else if (scores [0 ] > scores [1 ]) {
32
+ //checks if the even score is greater than the odd like the elif in the python example
28
33
return "Even" ;
29
34
} else {
30
35
return "Odd" ;
You can’t perform that action at this time.
0 commit comments