Skip to content

Commit 1f40d18

Browse files
committed
fix: Formatting issue by Dwight Blue
1 parent 9d48445 commit 1f40d18

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

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

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,27 @@
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-
var o = 0;
15-
var e = 0;
16-
while (head != null){
17-
if (head.val > head.next.val){
18-
e++;
19-
}
20-
else{
21-
o++;
22-
}
23-
head = head.next.next;
24-
}
25-
if ( e > o) {
26-
return "Even";
27-
} else if ( e<o) {
28-
return "Odd";
12+
var o = 0;
13+
var e = 0;
14+
while (head != null) {
15+
if (head.val > head.next.val) {
16+
e++;
17+
} else {
18+
o++;
2919
}
30-
else
31-
return "Tie";
32-
33-
}
34-
35-
}
20+
head = head.next.next;
21+
}
22+
if (e > o) {
23+
return "Even";
24+
} else if (e < o) {
25+
return "Odd";
26+
} else return "Tie";
27+
}
28+
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.codedifferently.lesson12;
22

3-
43
/** Implement the below Stack by providing code for the class methods. */
54
public class Stack {
65
private ListNode top;
76

87
public Stack() {
98
this.top = null;
109
}
10+
1111
public void push(int value) {
12-
ListNode newTop = new ListNode (value);
12+
ListNode newTop = new ListNode(value);
1313
newTop.next = top;
1414
top = newTop;
1515
}
@@ -29,4 +29,3 @@ public boolean isEmpty() {
2929
return top == null;
3030
}
3131
}
32-

0 commit comments

Comments
 (0)