Skip to content

Commit aaec6a1

Browse files
committed
Feat adds: added comments
1 parent cd7fcff commit aaec6a1

File tree

1 file changed

+5
-0
lines changed
  • lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12

1 file changed

+5
-0
lines changed

lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12/Lesson12.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ public String gameResult(ListNode head) {
1717
scores[head.val % 2]++;
1818
// Gpt help ended at the line above
1919
} else {
20+
//else will only be applicable if the previous condition is false
2021
scores[head.next.val % 2]++;
22+
//increments score for the next node value
2123
}
2224
}
2325
head = head.next;
26+
//reassigns the variable, head, to point to the next node in the list
2427
}
2528
if (scores[0] == scores[1]) {
29+
//checks for a tie
2630
return "Tie";
2731
} else if (scores[0] > scores[1]) {
32+
//checks if the even score is greater than the odd like the elif in the python example
2833
return "Even";
2934
} else {
3035
return "Odd";

0 commit comments

Comments
 (0)