Skip to content

Commit 612a189

Browse files
committed
fix: edited lesson12.java and ListNode.java files
1 parent 48f21eb commit 612a189

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

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

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

3-
import java.util.LinkedList;
3+
/* import java.util.LinkedList; */
44
import java.util.ArrayList;
5+
/* import java.util.List; */
56
import java.util.List;
67

78
public class Lesson12 {
@@ -10,7 +11,7 @@ public class Lesson12 {
1011
* Provide the solution to LeetCode 3062 here:
1112
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
1213
*/
13-
class TeamNode {
14+
/* class TeamNode {
1415
int data;
1516
TeamNode next;
1617
@@ -34,13 +35,13 @@ public void add(int data) {
3435
}
3536
temp.next = newTeamNode;
3637
}
37-
}
38+
} */
3839

39-
public String gameResult(TeamNode head) {
40+
public String gameResult(/* Team */ListNode head) {
4041
List<String> result = new ArrayList<>();
4142
int evenCounter = 0;
4243
int oddCounter = 0;
43-
TeamNode current = head;
44+
/* Team */ListNode current = head;
4445

4546
while (current != null && current.next != null) {
4647
int evenValue = current.data;
@@ -66,31 +67,28 @@ public String gameResult(TeamNode head) {
6667
winningTeam = "tie";
6768
}
6869

69-
System.out.println("Nodes with higher values in each pair: " + result);
70+
System.out.println("Node team with higher value in each pair: " + result);
7071
System.out.println("The team with the most high-values is: " + winningTeam);
7172

7273
return winningTeam;
7374
}
7475
}
7576

7677

77-
public class Main {
78+
/* public class Main {
7879
public static void main(String[] args) {
7980
LinkedList list = new LinkedList();
8081
81-
// Adding some nodes to the linked list
8282
list.add(2);
8383
list.add(5);
8484
list.add(4);
8585
list.add(7);
8686
list.add(20);
8787
list.add(5);
8888
89-
// Call the function to compare pairs and determine the group with the most high-value pairs
9089
String winningTeam = list.gameResult(list.head);
9190
92-
// Output the dominant group
9391
System.out.println("Team with most high-value pairs: " + winningTeam);
9492
}
9593
}
96-
}
94+
} */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ListNode {
1616
}
1717

1818

19-
public static String listWinner(ListNode head) {
19+
/* public static String listWinner(ListNode head) {
2020
int evenScore = 0;
2121
int oddScore = 0;
2222
@@ -48,5 +48,5 @@ public static void main(String[] args) {
4848
4949
String winner = listWinner(head);
5050
System.out.println("The winner is: " + winner);
51-
}
51+
} */
5252
}

0 commit comments

Comments
 (0)