当前位置:网站首页>6090. 极大极小游戏
6090. 极大极小游戏
2022-07-02 12:10:00 【紫菜(Nori)】
class Solution {
public:
int minMaxGame(vector<int>& nums) {
int i = 0;
int len = nums.size();
while(len != 1){
// i可到达的位置
int availableLen = len >> 1;
while(i < availableLen){
int ind = (i << 1);
if(1 == (i & 0x01)){
// 奇数
nums[i] = max(nums[ind], nums[ind + 1]);
}else{
// 偶数
nums[i] = min(nums[ind], nums[ind + 1]);
}
i++;
}
// 开始下一次访问
i = 0;
// 对半
len >>= 1;
}
return nums[0];
}
};边栏推荐
- 飞凌嵌入式RZ/G2L处理器核心板及开发板上手评测
- 【LeetCode】977-有序數組的平方
- PTA ladder game exercise set l2-001 inter city emergency rescue
- Steps for Navicat to create a new database
- YOLOV5 代码复现以及搭载服务器运行
- 基于RZ/G2L | OK-G2LD-C开发板存储读写速度与网络实测
- (4) Flink's table API and SQL table schema
- 【LeetCode】577-反转字符串中的单词 III
- (Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
- Storage read-write speed and network measurement based on rz/g2l | ok-g2ld-c development board
猜你喜欢

Redux - detailed explanation

18_ Redis_ Redis master-slave replication & cluster building

终于搞懂了JS中的事件循环,同步/异步,微任务/宏任务,运行机制(附笔试题)

LeetCode刷题——统计各位数字都不同的数字个数#357#Medium

List set & UML diagram

Redux——详解
![[development environment] install the Chinese language pack for the 2013 version of visual studio community (install test agents 2013 | install visual studio 2013 simplified Chinese)](/img/cf/38e4035c3b318814672f21c8a42618.jpg)
[development environment] install the Chinese language pack for the 2013 version of visual studio community (install test agents 2013 | install visual studio 2013 simplified Chinese)

14_ Redis_ Optimistic lock

【网络安全】网络资产收集

16_ Redis_ Redis persistence
随机推荐
6095. 强密码检验器 II
党史纪实主题公益数字文创产品正式上线
【LeetCode】577-反转字符串中的单词 III
MD5加密
QML pop-up frame, customizable
03. Preliminary use of golang
Case introduction and problem analysis of microservice
Semantic segmentation learning notes (1)
How does the computer set up speakers to play microphone sound
面对“缺芯”挑战,飞凌如何为客户产能提供稳定强大的保障?
让您的HMI更具优势,FET-G2LD-C核心板是个好选择
12_Redis_Bitmap_命令
How to avoid 7 common problems in mobile and network availability testing
02. After containerization, you must face golang
14_ Redis_ Optimistic lock
Leetcode question brushing - parity linked list 328 medium
损失函数与正负样本分配:YOLO系列
Leetcode skimming -- verifying the preorder serialization of binary tree # 331 # medium
6092. 替换数组中的元素
12_ Redis_ Bitmap_ command