Skip to content

Commit 14c0b0f

Browse files
committed
Solution to find the peak element in a Mountain Array
1 parent ddc34d0 commit 14c0b0f

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/BinaySearch/InfiniteArray.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ static int findingRange(int[] array, int target){
1616
while (target > array[end]){
1717
int temp = end + 1;
1818
end = end + (end-start+1) * 2;
19+
20+
/*Another possible formula to calculate the next start and next end*/
21+
// start = end + 1;
22+
// end = (start * 2) + 1;
1923
}
2024

2125
return binarySearch(array,target,start,end);

‎src/BinaySearch/MountainArray.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package BinaySearch;
2+
3+
public class MountainArray {
4+
public static void main(String[] args) {
5+
6+
}
7+
}

0 commit comments

Comments
 (0)