Skip to content

Commit 68d267c

Browse files
committed
Feat: Adds Shawn Dunsmore Jr Added spotlessapply
1 parent 567346d commit 68d267c

File tree

2 files changed

+49
-48
lines changed

2 files changed

+49
-48
lines changed

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22

33
public class Lesson12 {
44

5-
/**
6-
* Provide the solution to LeetCode 3062 here:
7-
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
8-
*/
5+
/**
6+
* Provide the solution to LeetCode 3062 here:
7+
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
8+
*/
9+
public String gameResult(ListNode head) {
10+
int oddPoints = 0;
11+
int evenPoints = 0;
912

10-
public String gameResult(ListNode head) {
11-
int oddPoints = 0;
12-
int evenPoints = 0;
13-
14-
for (ListNode current = head; current != null && current.next != null; current = current.next.next) {
15-
if (current.val < current.next.val) {
16-
oddPoints++;
17-
} else if (current.val > current.next.val) {
18-
evenPoints++;
19-
}
20-
}
13+
for (ListNode current = head;
14+
current != null && current.next != null;
15+
current = current.next.next) {
16+
if (current.val < current.next.val) {
17+
oddPoints++;
18+
} else if (current.val > current.next.val) {
19+
evenPoints++;
20+
}
21+
}
2122

22-
if (oddPoints > evenPoints) {
23-
return "Odd";
24-
} else if (evenPoints > oddPoints) {
25-
return "Even";
26-
} else {
27-
return "Tie";
28-
}
23+
if (oddPoints > evenPoints) {
24+
return "Odd";
25+
} else if (evenPoints > oddPoints) {
26+
return "Even";
27+
} else {
28+
return "Tie";
2929
}
30-
}
30+
}
31+
}
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
package com.codedifferently.lesson12;
22

33
/** Implement the below Stack by providing code for the class methods. */
4-
public class Stack {
5-
private ListNode top;
4+
public class Stack {
5+
private ListNode top;
66

7-
public Stack() {
8-
this.top = null;
9-
}
7+
public Stack() {
8+
this.top = null;
9+
}
1010

11-
public void push(int value) {
12-
ListNode newNode = new ListNode(value);
13-
newNode.next = top;
14-
top = newNode;
15-
}
11+
public void push(int value) {
12+
ListNode newNode = new ListNode(value);
13+
newNode.next = top;
14+
top = newNode;
15+
}
1616

17-
public int pop() {
18-
if (isEmpty()) {
19-
throw new IllegalStateException("Stack is empty");
20-
}
21-
int value = top.val;
22-
top = top.next;
23-
return value;
17+
public int pop() {
18+
if (isEmpty()) {
19+
throw new IllegalStateException("Stack is empty");
2420
}
21+
int value = top.val;
22+
top = top.next;
23+
return value;
24+
}
2525

26-
public int peek() {
27-
if (isEmpty()) {
28-
throw new IllegalStateException("Stack is empty");
29-
}
30-
return top.val;
26+
public int peek() {
27+
if (isEmpty()) {
28+
throw new IllegalStateException("Stack is empty");
3129
}
30+
return top.val;
31+
}
3232

33-
public boolean isEmpty() {
34-
return top == null;
35-
}
33+
public boolean isEmpty() {
34+
return top == null;
35+
}
3636
}

0 commit comments

Comments
 (0)