leetcode852
int peakIndexInMountainArray(vector<int>& A) {
int Len = A.size();
int position = -;
for (int i = ; i < Len - ; i++)
{
if (A[i] > A[i - ] && A[i] > A[i + ])
{
position = i;
break;
}
}
return position;
}
leetcode852的更多相关文章
- [Swift]LeetCode852. 山脉数组的峰顶索引 | Peak Index in a Mountain Array
Let's call an array A a mountain if the following properties hold: A.length >= 3 There exists som ...
随机推荐
- redux源码阅读之compose,applyMiddleware
我的观点是,看别人的源码,不追求一定要能原样造轮子,单纯就是学习知识,对于程序员的提高就足够了.在阅读redux的compose源码之前,我们先学一些前置的知识. redux源码阅读之compose, ...
- Mysql中文汉字转拼音的实现(每个汉字转换全拼)
-- 创建汉字拼音对照临时表 CREATE TABLE IF NOT EXISTS `t_base_pinyin` ( `pin_yin_` varchar(255) CHARACTER SET gb ...
- 基于Python和Tornado的WEB Terminal
https://github.com/liftoff/GateOne 亮点有以下: ↪ Clientless ↪ Multi-User and Multi-Session ↪ Multi-Auth a ...
- Python label for _ 用法
Python label for _ 用法 Python label for _ 用法 >>> label_data = [iter([3,4]),iter([4,9]), iter ...
- 手把手教你怎么用ArcgisOnline发布地图服务
Arcgis推出了Arcgis Online,但是大家都不知道这是个什么东西,怎么用这个东西,今天这篇文章手把手的教你如何使用Arcgisonline发布地图服务. 一.ArcgisOnline简介 ...
- istreambuf_iterator
#include <set> #include <stdio.h> #include <iostream> #include <istream> #in ...
- ubuntu 添加新硬盘
查看硬盘: # fdisk -l ... Disk /dev/sdb: 274.9 GB, 274877906944 bytes 255 heads, 63 sectors/track, 33418 ...
- php项目,cpu暴增问题查找
背景: 前几天通过WordPress上线一个应用(前后台部署分离,后台走内网内部使用,前台做了全站缓存对外使用). 今天访问后台应用发现开始报504,一段时间后全部504. 解决方案: 登录容器发现容 ...
- 当导用模块与包的import与from的问题(模块与包的调用)
当在views.py里写impor models会不会报错呢? 1.Python里面的py文件都是每一行的代码. 2.Python解释器去找一个模块的时候,只去sys.path的路径里找 3.djan ...
- poj 3517
题目链接 http://poj.org/problem?id=3517 题意 约瑟夫环 要求最后删掉的那个人是谁: 方法 理解递推公式就行了 考虑这样一组数据 k ...