File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 179
179
| 2032| [ 至少在两个数组中出现的值] ( https://leetcode.cn/problems/two-out-of-three/ ) | [ JavaScript] ( ./algorithms/two-out-of-three.js ) | Easy|
180
180
| 2283| [ 判断一个数的数字计数是否等于数位的值] ( https://leetcode.cn/problems/check-if-number-has-equal-digit-count-and-digit-value/ ) | [ JavaScript] ( ./algorithms/check-if-number-has-equal-digit-count-and-digit-value.js ) | Easy|
181
181
| 2287| [ 重排字符形成目标字符串] ( https://leetcode.cn/problems/rearrange-characters-to-make-target-string/ ) | [ JavaScript] ( ./algorithms/rearrange-characters-to-make-target-string.js ) | Easy|
182
+ | 2293| [ 极大极小游戏] ( https://leetcode.cn/problems/min-max-game/ ) | [ JavaScript] ( ./algorithms/min-max-game.js ) | Easy|
182
183
| 面试题 04.12| [ 面试题 04.12. 求和路径] ( https://leetcode.cn/problems/paths-with-sum-lcci/ ) | [ JavaScript] ( ./algorithms/paths-with-sum-lcci.js ) | Medium|
183
184
| 面试题 02.07| [ 面试题 02.07. 链表相交] ( https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ ) | [ JavaScript] ( ./algorithms/intersection-of-two-linked-lists-lcci.js ) | Easy|
184
185
| 剑指 Offer 05. 替换空格| [ 剑指 Offer 05. 替换空格] ( https://leetcode.cn/problems/ti-huan-kong-ge-lcof/ ) | [ JavaScript] ( ./algorithms/ti-huan-kong-ge-lcof.js ) | Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number[] } nums
3
+ * @return {number }
4
+ */
5
+ var minMaxGame = function ( nums ) {
6
+ let temp ;
7
+ while ( nums . length !== 1 ) {
8
+ temp = [ ] ;
9
+ for ( let i = 0 ; i < nums . length / 2 ; i ++ ) {
10
+ if ( i % 2 === 0 ) {
11
+ temp [ i ] = Math . min ( nums [ 2 * i ] , nums [ 2 * i + 1 ] ) ;
12
+ } else {
13
+ temp [ i ] = Math . max ( nums [ 2 * i ] , nums [ 2 * i + 1 ] ) ;
14
+ }
15
+ }
16
+ nums = temp ;
17
+ }
18
+ return nums [ 0 ] ;
19
+ } ;
You can’t perform that action at this time.
0 commit comments