File tree 3 files changed +67
-8
lines changed
3 files changed +67
-8
lines changed Original file line number Diff line number Diff line change 6
6
< body >
7
7
< script >
8
8
function solution ( a , b ) {
9
- let answer = "" ;
9
+ let answer = '' ;
10
10
11
11
a . forEach ( ( ele , index ) => {
12
12
if ( a [ index ] === b [ index ] ) {
13
- answer = answer + "D " ;
13
+ answer = answer + 'D ' ;
14
14
}
15
15
if ( a [ index ] === 1 && b [ index ] === 2 ) {
16
- answer = answer + "B " ;
16
+ answer = answer + 'B ' ;
17
17
}
18
18
if ( a [ index ] === 1 && b [ index ] === 3 ) {
19
- answer = answer + "A " ;
19
+ answer = answer + 'A ' ;
20
20
}
21
21
if ( a [ index ] === 2 && b [ index ] === 1 ) {
22
- answer = answer + "A " ;
22
+ answer = answer + 'A ' ;
23
23
}
24
24
if ( a [ index ] === 2 && b [ index ] === 3 ) {
25
- answer = answer + "B " ;
25
+ answer = answer + 'B ' ;
26
26
}
27
27
if ( a [ index ] === 3 && b [ index ] === 1 ) {
28
- answer = answer + "B " ;
28
+ answer = answer + 'B ' ;
29
29
}
30
30
if ( a [ index ] === 3 && b [ index ] === 2 ) {
31
- answer = answer + " A" ;
31
+ answer = answer + ' A' ;
32
32
}
33
33
} ) ;
34
34
Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < meta charset ="UTF-8 " />
4
+ < title > 출력결과</ title >
5
+ </ head >
6
+ < body >
7
+ < script >
8
+ function solution ( arr ) {
9
+ let answer = [ arr [ 0 ] ] ;
10
+
11
+ for ( let i = 1 ; i < arr . length ; i ++ ) {
12
+ if ( answer [ answer . length - 1 ] !== arr [ i ] ) {
13
+ answer . push ( arr [ i ] ) ;
14
+ }
15
+ }
16
+ return answer ;
17
+ }
18
+
19
+ let a = [ 4 , 4 , 4 , 3 , 3 ] ;
20
+
21
+ console . log ( solution ( a ) ) ;
22
+ </ script >
23
+ </ body >
24
+ </ html >
Original file line number Diff line number Diff line change
1
+ < html >
2
+ < head >
3
+ < meta charset ="UTF-8 " />
4
+ < title > 출력결과</ title >
5
+ </ head >
6
+ < body >
7
+ < script >
8
+ function solution ( sizes ) {
9
+ let left = [ ] ;
10
+ let right = [ ] ;
11
+
12
+ let rotated = sizes . map ( ( size ) => {
13
+ return size . sort ( ( a , b ) => a - b ) ;
14
+ } ) ;
15
+
16
+ rotated . forEach ( ( [ le , ri ] ) => {
17
+ left . push ( le ) ;
18
+ right . push ( ri ) ;
19
+ } ) ;
20
+
21
+ return Math . max ( ...left ) * Math . max ( ...right ) ;
22
+ }
23
+
24
+ let sizes = [
25
+ [ 14 , 4 ] ,
26
+ [ 19 , 6 ] ,
27
+ [ 6 , 16 ] ,
28
+ [ 18 , 7 ] ,
29
+ [ 7 , 11 ] ,
30
+ ] ;
31
+
32
+ console . log ( solution ( sizes ) ) ;
33
+ </ script >
34
+ </ body >
35
+ </ html >
You can’t perform that action at this time.
0 commit comments