Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peak Index in a Mountain Array #108

Open
soniadessai opened this issue Oct 1, 2023 · 2 comments
Open

Peak Index in a Mountain Array #108

soniadessai opened this issue Oct 1, 2023 · 2 comments

Comments

@soniadessai
Copy link
Collaborator

Write code in the preferred language and attach output with it.

An array arr is a mountain if the following properties hold:

arr.length >= 3
There exists some i with 0 < i < arr.length - 1 such that:
arr[0] < arr[1] < ... < arr[i - 1] < arr[i]
arr[i] > arr[i + 1] > ... > arr[arr.length - 1]
Given a mountain array arr, return the index i such that arr[0] < arr[1] < ... < arr[i - 1] < arr[i] > arr[i + 1] > ... > arr[arr.length - 1].

You must solve it in O(log(arr.length)) time complexity.

Example 1:

Input: arr = [0,1,0]
Output: 1

Example 2:

Input: arr = [0,2,1,0]
Output: 1

Example 3:

Input: arr = [0,10,5,2]
Output: 1

@Anuragpal010104
Copy link

Anuragpal010104 commented Oct 1, 2023

@Sonia312 Can you please assign this issue to me under HACKTOBERFEST :)

suhas-09 added a commit to suhas-09/Competitive-Programming-2023 that referenced this issue Oct 1, 2023
This was referenced Oct 1, 2023
@hitali-khachane
Copy link
Contributor

Can u please Assign me this issue
C number-UCE2021434
Name-Hitali Khachane
[email protected]
Cummins college of engineering pune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants