11package com .codedifferently .lesson12 ;
22
3- import java .util .LinkedList ;
3+ /* import java.util.LinkedList; */
44import java .util .ArrayList ;
5+ /* import java.util.List; */
56import java .util .List ;
67
78public 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+ } */
0 commit comments