Skip to content

Commit a8c470a

Browse files
committed
solution
1 parent 0042f0a commit a8c470a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LeetCode Problems' Solutions in JavaScript
1717
## medium
1818

1919
1. [数组中的第 K 个最大元素](./algorithms/medium/findKthLargest/findKthLargest.js)
20-
1. [分类颜色](./algorithms/medium/sortColors/sortColors.js)
20+
2. [分类颜色](./algorithms/medium/sortColors/sortColors.js)
21+
3. [寻找峰值](./algorithms/medium/findPeakElement/findPeakElement.js)
2122

2223
## hard
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// description: https://leetcode-cn.com/explore/interview/card/top-interview-questions-medium/50/sorting-and-searching/99/
2+
// 寻找峰值
3+
4+
/**
5+
* @param {number[]} nums
6+
* @return {number}
7+
*/
8+
var findPeakElement = function(nums) {
9+
for (var i = 0, len = nums.length; i < len - 1; i++) {
10+
if (nums[i] > nums[i + 1]) return i;
11+
}
12+
return nums.length - 1;
13+
};

0 commit comments

Comments
 (0)