Skip to content

Commit 1a6ff0d

Browse files
committed
fix: removed all unused code
1 parent 612a189 commit 1a6ff0d

File tree

2 files changed

+4
-81
lines changed

2 files changed

+4
-81
lines changed
Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.codedifferently.lesson12;
22

3-
/* import java.util.LinkedList; */
3+
44
import java.util.ArrayList;
5-
/* import java.util.List; */
65
import java.util.List;
76

87
public class Lesson12 {
@@ -11,37 +10,13 @@ public class Lesson12 {
1110
* Provide the solution to LeetCode 3062 here:
1211
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
1312
*/
14-
/* class TeamNode {
15-
int data;
16-
TeamNode next;
17-
18-
public TeamNode(int data) {
19-
this.data = data;
20-
this.next = null;
21-
}
22-
}
13+
2314

24-
class LinkedList {
25-
TeamNode head;
26-
27-
public void add(int data) {
28-
TeamNode newTeamNode = new TeamNode(data);
29-
if (head == null) {
30-
head = newTeamNode;
31-
} else {
32-
TeamNode temp = head;
33-
while (temp.next != null) {
34-
temp = temp.next;
35-
}
36-
temp.next = newTeamNode;
37-
}
38-
} */
39-
40-
public String gameResult(/* Team */ListNode head) {
15+
public String gameResult(ListNode head) {
4116
List<String> result = new ArrayList<>();
4217
int evenCounter = 0;
4318
int oddCounter = 0;
44-
/* Team */ListNode current = head;
19+
ListNode current = head;
4520

4621
while (current != null && current.next != null) {
4722
int evenValue = current.data;
@@ -75,20 +50,3 @@ public String gameResult(/* Team */ListNode head) {
7550
}
7651

7752

78-
/* public class Main {
79-
public static void main(String[] args) {
80-
LinkedList list = new LinkedList();
81-
82-
list.add(2);
83-
list.add(5);
84-
list.add(4);
85-
list.add(7);
86-
list.add(20);
87-
list.add(5);
88-
89-
String winningTeam = list.gameResult(list.head);
90-
91-
System.out.println("Team with most high-value pairs: " + winningTeam);
92-
}
93-
}
94-
} */

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,4 @@ public class ListNode {
1414
this.val = val;
1515
this.next = next;
1616
}
17-
18-
19-
/* public static String listWinner(ListNode head) {
20-
int evenScore = 0;
21-
int oddScore = 0;
22-
23-
ListNode current = head;
24-
while (current != null && current.next != null) {
25-
int evenVal = current.val;
26-
int oddVal = current.next.val;
27-
28-
if (evenVal > oddVal) {
29-
evenScore++;
30-
} else if (oddVal > evenVal) {
31-
oddScore++;
32-
}
33-
34-
current = current.next.next;
35-
}
36-
37-
if (evenScore > oddScore) {
38-
return "Even";
39-
} else if (oddScore > evenScore) {
40-
return "Odd";
41-
} else {
42-
return "Tie";
43-
}
44-
}
45-
46-
public static void main(String[] args) {
47-
ListNode head = new ListNode(2, new ListNode(5, new ListNode(4, new ListNode(7, new ListNode(20, new ListNode(5))))));
48-
49-
String winner = listWinner(head);
50-
System.out.println("The winner is: " + winner);
51-
} */
5217
}

0 commit comments

Comments
 (0)