提交 905076c8 编写于 作者: GreyZeng's avatar GreyZeng

find peak elem

上级 3e4bf280
...@@ -18,7 +18,7 @@ public class LeetCode_0162_FindPeakElement { ...@@ -18,7 +18,7 @@ public class LeetCode_0162_FindPeakElement {
if (nums.length == 2) { if (nums.length == 2) {
return nums[0] > nums[1] ? 0 : 1; return nums[0] > nums[1] ? 0 : 1;
} }
int l = 0; int l = 0;
int r = nums.length - 1; int r = nums.length - 1;
while (l <= r) { while (l <= r) {
if (nums[l] > nums[l + 1]) { if (nums[l] > nums[l + 1]) {
...@@ -39,5 +39,5 @@ public class LeetCode_0162_FindPeakElement { ...@@ -39,5 +39,5 @@ public class LeetCode_0162_FindPeakElement {
} }
return -1; return -1;
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册