Skip to content

Commit 40ac10f

Browse files
committed
fix: Fixes build run using spotless apply
1 parent d078816 commit 40ac10f

File tree

1 file changed

+18
-24
lines changed
  • lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12

1 file changed

+18
-24
lines changed

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

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,28 @@
22

33
public class Lesson12 {
44

5-
public Lesson12() {
6-
7-
}
5+
public Lesson12() {}
86

97
/**
108
* Provide the solution to LeetCode 3062 here:
119
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
1210
*/
1311
public String gameResult(ListNode head) {
14-
ListNode current = head;
15-
int oddPoints = 0;
16-
int evenPoints = 0;
17-
while (current != null){
18-
if (current.val > current.next.val){
19-
evenPoints++;
20-
}
21-
else{
22-
oddPoints++;
23-
}
24-
current = current.next.next;
25-
}
26-
if ( evenPoints > oddPoints) {
27-
return "Even";
28-
} else if ( evenPoints<oddPoints) {
29-
return "Odd";
12+
ListNode current = head;
13+
int oddPoints = 0;
14+
int evenPoints = 0;
15+
while (current != null) {
16+
if (current.val > current.next.val) {
17+
evenPoints++;
18+
} else {
19+
oddPoints++;
3020
}
31-
else return "Tie";
32-
33-
}
34-
35-
}
21+
current = current.next.next;
22+
}
23+
if (evenPoints > oddPoints) {
24+
return "Even";
25+
} else if (evenPoints < oddPoints) {
26+
return "Odd";
27+
} else return "Tie";
28+
}
29+
}

0 commit comments

Comments
 (0)