Skip to content

Instantly share code, notes, and snippets.

//https://leetcode.com/problems/find-in-mountain-array/
class Solution {
public:
int findInMountainArray(int target, MountainArray &mountainArr) {
int start=0, end = mountainArr.length()-1;
int peak = peakIndexInmountainArr(mountainArr);
int firstTry = orderAgnosticBS(mountainArr, target, 0, peak);
if (firstTry != -1)
return firstTry;
// try to search in second half