当前位置:网站首页>6090. Minimax games
6090. Minimax games
2022-07-02 15:40:00 【Laver (nori)】
class Solution {
public:
int minMaxGame(vector<int>& nums) {
int i = 0;
int len = nums.size();
while(len != 1){
// i Accessible location
int availableLen = len >> 1;
while(i < availableLen){
int ind = (i << 1);
if(1 == (i & 0x01)){
// Odd number
nums[i] = max(nums[ind], nums[ind + 1]);
}else{
// even numbers
nums[i] = min(nums[ind], nums[ind + 1]);
}
i++;
}
// Start the next visit
i = 0;
// Half and half
len >>= 1;
}
return nums[0];
}
};
边栏推荐
- 02. After containerization, you must face golang
- [leetcode] 1140 stone game II
- LeetCode刷题——递增的三元子序列#334#Medium
- [leetcode] 1020 number of enclaves
- 【LeetCode】977-有序数组的平方
- Facing the challenge of "lack of core", how can Feiling provide a stable and strong guarantee for customers' production capacity?
- Evaluation of embedded rz/g2l processor core board and development board of Feiling
- Real estate market trend outlook in 2022
- LeetCode刷题——两整数之和#371#Medium
- 【LeetCode】877-石子游戏
猜你喜欢
18_ Redis_ Redis master-slave replication & cluster building
How to intercept the value of a key from the JSON string returned by wechat?
4. Jctree related knowledge learning
LeetCode刷题——递增的三元子序列#334#Medium
Beijing rental data analysis
彻底弄懂浏览器强缓存和协商缓存
Redux - detailed explanation
FPGA - clock-03-clock management module (CMT) of internal structure of 7 Series FPGA
2022 年辽宁省大学生数学建模A、B、C题(相关论文及模型程序代码网盘下载)
Markdown tutorial
随机推荐
【LeetCode】577-反转字符串中的单词 III
【LeetCode】977-有序數組的平方
SQL transaction
【LeetCode】1905-统计子岛屿
FPGA - 7系列 FPGA内部结构之Clocking -03- 时钟管理模块(CMT)
Leetcode skimming -- verifying the preorder serialization of binary tree # 331 # medium
YOLOV5 代码复现以及搭载服务器运行
[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)
高考录取分数线爬取
2022 年辽宁省大学生数学建模A、B、C题(相关论文及模型程序代码网盘下载)
PTA ladder game exercise set l2-001 inter city emergency rescue
已知两种遍历序列构造二叉树
MySQL -- Index Optimization -- order by
[leetcode] 344 reverse string
基于RZ/G2L | OK-G2LD-C开发板存储读写速度与网络实测
【LeetCode】876-链表的中间结点
Steps for Navicat to create a new database
Beijing rental data analysis
Bing. Site Internet
6092. 替换数组中的元素