File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change 1
1
const timeToMixJuice = ( name ) => {
2
2
// code here
3
- return ;
3
+ switch ( name ) {
4
+ case "Pure Strawberry Joy" :
5
+ return 0.5 ;
6
+ case "Energizer" :
7
+ case "Green Garden" :
8
+ return 1.5 ;
9
+ case "Tropical Island" :
10
+ return 3 ;
11
+ case "All or Nothing" :
12
+ return 5 ;
13
+ default :
14
+ return 2.5 ;
15
+ }
4
16
} ;
5
17
6
18
const limesToCut = ( wedgesNeeded , limes ) => {
7
19
// code here
20
+ let wedges = 0 ;
21
+ for ( let i = 0 ; i < limes . length ; i ++ ) {
22
+ if ( limes [ i ] === "small" ) wedges += 6 ;
23
+ else if ( limes [ i ] === "medium" ) wedges += 8 ;
24
+ else wedges += 10 ;
8
25
9
- return ;
26
+ if ( wedges >= wedgesNeeded ) return i + 1 ;
27
+ }
28
+ return limes . length ;
10
29
} ;
11
30
12
31
const remainingOrders = ( timeLeft , orders ) => {
13
32
// code here
14
-
15
- return ;
33
+ let timetaken = 0 ;
34
+ for ( let i = 0 ; i < orders . length ; i ++ ) {
35
+ timetaken += timeToMixJuice ( orders [ i ] ) ;
36
+ orders . splice ( 0 , 1 ) ;
37
+ if ( timetaken >= timeLeft ) break ;
38
+ }
39
+ return orders ;
16
40
} ;
You can’t perform that action at this time.
0 commit comments