当前位置:网站首页>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];
}
};
边栏推荐
猜你喜欢
Leetcode skimming -- incremental ternary subsequence 334 medium
Bing. Site Internet
03.golang初步使用
【LeetCode】417-太平洋大西洋水流问题
How to find a sense of career direction
已知两种遍历序列构造二叉树
Yolo format data set processing (XML to txt)
【网络安全】网络资产收集
Thoroughly understand browser strong cache and negotiation cache
yolo格式数据集处理(xml转txt)
随机推荐
5. Practice: jctree implements the annotation processor at compile time
提前批院校名称
03. Preliminary use of golang
损失函数与正负样本分配:YOLO系列
面对“缺芯”挑战,飞凌如何为客户产能提供稳定强大的保障?
【LeetCode】577-反转字符串中的单词 III
基于RZ/G2L | OK-G2LD-C开发板存储读写速度与网络实测
Party History Documentary theme public welfare digital cultural and creative products officially launched
6.12 企业内部upp平台(Unified Process Platform)的关键一刻
10_ Redis_ geospatial_ command
. Solution to the problem of Chinese garbled code when net core reads files
[leetcode] 1020 number of enclaves
彻底弄懂浏览器强缓存和协商缓存
【LeetCode】19-删除链表的倒数第N个结点
Build your own semantic segmentation platform deeplabv3+
【LeetCode】1254-统计封闭岛屿的数量
Evaluation of embedded rz/g2l processor core board and development board of Feiling
【LeetCode】977-有序数组的平方
11_ Redis_ Hyperloglog_ command
[leetcode] 1140 stone game II