File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
lesson_10/libraries/src/loaders
lesson_12/structs_java/structs_app/src/main/java/com/codedifferently/lesson12 Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { AnthonyMaysLoader } from './anthony_mays_loader.js';
4
4
import { JamesCapparellLoader } from './james_capparell_loader.js' ;
5
5
import { NileJacksonLoader } from './nile_jackson_loader.js' ;
6
6
import { XavierCruzLoader } from './xavier_cruz_loader.js' ;
7
+ import { ChigazoGrahamLoader } from './chigazo_graham_loader.js' ;
7
8
8
9
export const Loaders = Symbol . for ( 'Loaders' ) ;
9
10
@@ -14,6 +15,7 @@ const LOADER_PROVIDERS = [
14
15
JamesCapparellLoader ,
15
16
NileJacksonLoader ,
16
17
XavierCruzLoader ,
18
+ ChigazoGrahamLoader ,
17
19
] ;
18
20
19
21
@Module ( {
Original file line number Diff line number Diff line change @@ -7,6 +7,27 @@ public class Lesson12 {
7
7
* https://github.com/yang-su2000/Leetcode-algorithm-practice/tree/master/3062-winner-of-the-linked-list-game
8
8
*/
9
9
public String gameResult (ListNode head ) {
10
- return null ;
10
+ int evenCounter = 0 ; //Keeps track of even score
11
+ int oddCounter = 0 ; //Keeps track of odd score
12
+
13
+ int evenValue = head .val ; //Makes the first even value to compare equal to the first number of the list
14
+ int oddValue = head .next .val ; //Makes the first odd value to compare equal to the second number of the list
15
+
16
+ if ( evenValue > oddValue ) {
17
+ evenCounter = evenCounter + 1 ;
18
+ //Compares the even and odd value, adds 1 to even score if even is greater
19
+ } else {
20
+ oddCounter = ++oddCounter + 1 ;
21
+ } //Compares the even and odd value, adds 1 to odd score if odd is greater
22
+
23
+ if (evenCounter > oddCounter ) {
24
+ return "Even" ;
25
+ //Compares the even and odd score, prints 'Even' if Evens score is greater
26
+ } if (evenCounter < oddCounter ) {
27
+ return "Odd" ;
28
+ //Compares the even and odd score, prints 'Odd' if odds score is greater
29
+ } else {
30
+ return "Tie" ;
31
+ } //Compares the even and odd score, prints 'Tie' if the two scores are equal
11
32
}
12
33
}
You can’t perform that action at this time.
0 commit comments