当前位置:网站首页>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];
}
};边栏推荐
- 12_ Redis_ Bitmap_ command
- FPGA - 7系列 FPGA内部结构之Clocking -03- 时钟管理模块(CMT)
- 做好抗“疫”之路的把关人——基于RK3568的红外热成像体温检测系统
- [network security] network asset collection
- 【LeetCode】486-预测赢家
- LeetCode刷题——验证二叉树的前序序列化#331#Medium
- List set & UML diagram
- NBA player analysis
- LeetCode_ Sliding window_ Medium_ 395. Longest substring with at least k repeated characters
- 13_Redis_事务
猜你喜欢

Facing the challenge of "lack of core", how can Feiling provide a stable and strong guarantee for customers' production capacity?

6.12 企业内部upp平台(Unified Process Platform)的关键一刻

Be a good gatekeeper on the road of anti epidemic -- infrared thermal imaging temperature detection system based on rk3568

微信支付宝账户体系和支付接口业务流程

Custom exception

Semantic segmentation learning notes (1)

MySQL calculate n-day retention rate

Wechat Alipay account system and payment interface business process

彻底弄懂浏览器强缓存和协商缓存

Yolo format data set processing (XML to txt)
随机推荐
Libcurl Lesson 13 static library introduces OpenSSL compilation dependency
Guangzhou Emergency Management Bureau issued a high temperature and high humidity chemical safety reminder in July
MD5 encryption
损失函数与正负样本分配:YOLO系列
【LeetCode】1020-飞地的数量
folium,确诊和密接轨迹上图
LeetCode_ String_ Simple_ 412.Fizz Buzz
Infra11199 database system
飞凌嵌入式RZ/G2L处理器核心板及开发板上手评测
Leetcode skimming - remove duplicate letters 316 medium
Party History Documentary theme public welfare digital cultural and creative products officially launched
folium地图无法显示的问题,临时性解决方案如下
. Net again! Happy 20th birthday
[leetcode] 876 intermediate node of linked list
PTA 天梯赛习题集 L2-001 城市间紧急救援
Data analysis thinking analysis methods and business knowledge - business indicators
党史纪实主题公益数字文创产品正式上线
Custom exception
04.进入云原生后的企业级应用构建的一些思考
(4) Flink's table API and SQL table schema