(int target, MountainArray mountainArr)
| 9 | |
| 10 | class Solution { |
| 11 | public int findInMountainArray(int target, MountainArray mountainArr) { |
| 12 | int maxIndex = findMax(mountainArr); |
| 13 | int leftResult = binarySearchLeft(mountainArr, target, maxIndex); |
| 14 | int rightResult = binarySearchRight(mountainArr, target, maxIndex); |
| 15 | |
| 16 | return (leftResult == -1 && rightResult == -1) ? -1 : leftResult == -1 ? rightResult : leftResult; |
| 17 | } |
| 18 | |
| 19 | public int findMax(MountainArray array) { |
| 20 | int left = 0; |
nothing calls this directly
no test coverage detected