Skip to content

Commit

Permalink
Feat adds: added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nilejack committed Oct 23, 2024
1 parent cd7fcff commit aaec6a1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@ public String gameResult(ListNode head) {
scores[head.val % 2]++;
// Gpt help ended at the line above
} else {
//else will only be applicable if the previous condition is false
scores[head.next.val % 2]++;
//increments score for the next node value
}
}
head = head.next;
//reassigns the variable, head, to point to the next node in the list
}
if (scores[0] == scores[1]) {
//checks for a tie
return "Tie";
} else if (scores[0] > scores[1]) {
//checks if the even score is greater than the odd like the elif in the python example
return "Even";
} else {
return "Odd";
Expand Down

0 comments on commit aaec6a1

Please sign in to comment.