最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Leetcode852. Peak Index in a Mountain Array

2022-02-12 13:06 作者:您是打尖兒還是住店呢  | 我要投稿

Let's call an array?arr?a?mountain?if the following properties hold:

  • arr.length >= 3

  • There exists some?i?with?0 < i?< arr.length - 1?such that:

    • arr[0] < arr[1] < ... arr[i-1] < arr[i]

    • arr[i] > arr[i+1] > ... > arr[arr.length - 1]

Given an integer array?arr?that is?guaranteed?to be?a mountain, return any?i?such that?arr[0] < arr[1] < ... arr[i - 1] < arr[i] > arr[i + 1] > ... > arr[arr.length - 1].

?

Example 1:

Input: arr = [0,1,0]Output: 1

Example 2:

Input: arr = [0,2,1,0]Output: 1

Example 3:

Input: arr = [0,10,5,2]Output: 1

?

Constraints:

  • 3 <= arr.length <= 104

  • 0 <= arr[i] <= 106

  • arr?is?guaranteed?to be a mountain array.


Success

Details?

Runtime:?1 ms, faster than?15.14%?of?Java?online submissions for?Peak Index in a Mountain Array.

Memory Usage:?45.8 MB, less than?19.80%?of?Java?online submissions for?Peak Index in a Mountain Array.


Leetcode852. Peak Index in a Mountain Array的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
临湘市| 和田市| 奉节县| 阜新市| 林芝县| 两当县| 三原县| 宕昌县| 凌云县| 定日县| 大悟县| 年辖:市辖区| 兴文县| 永州市| 大庆市| 青铜峡市| 屏南县| 罗山县| 武汉市| 登封市| 光山县| 乐安县| 广宗县| 铁岭县| 施甸县| 恭城| 瑞安市| 旺苍县| 南岸区| 汤阴县| 东平县| 靖西县| 连州市| 腾冲县| 保康县| 酒泉市| 涡阳县| 阜新市| 平顺县| 囊谦县| 正宁县|