FastPrepFind the Peak of a Rise-and-Fall Array
Problems/Find the Peak of a Rise-and-Fall Array

Find the Peak of a Rise-and-Fall Array

Adobe logoAdobe● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem asks for the position of the single peak in a list of numbers that rises and then falls. An entry from a fresher who interviewed for an SDE intern role at Adobe (a single 50-minute video round on 12 October 2022, rejected) lists a peak search among the round's five items. The round also had a coin puzzle, a tree diameter task, a string permutation test and a ticket-booking design question. Under that item the entry keeps the title, the site's short summary and the author's own code. That code walks the whole array and returns where the largest value sits. It gives no limits or examples of its own. The site's summary lets an array hold several peaks and accepts any of them.

Our choices: the array has exactly one peak and no equal neighbours, so the answer is a single index that we can compare. There are 1 to 10^4 values from -10^9 to 10^9. The examples are new. The editorial shows that the same binary search also finds some peak when several exist.

Our version is about 75% the same as the reported question.

You are given an integer array nums. A peak is a value that is larger than each of its neighbours. The first and last values have only one neighbour each, so the first value is a peak when it is larger than the second, and the last value is a peak when it is larger than the one before it.

In this problem the array has exactly one peak: the values strictly rise until the peak and strictly fall after it (the rising part or the falling part may be empty). Return the index of the peak.

Function

peakIndex(nums: int[]) → int

Examples

Example 1

nums = [2,5,9,7,4,1]return = 2

The values rise from 2 to 9 and then fall to 1. Only 9 is larger than both of its neighbours (5 and 7), and it sits at index 2.

Example 2

nums = [8,6,3]return = 0

The values only fall. The first value 8 has no left neighbour and is larger than 6, so the peak is at index 0.

Example 3

nums = [-4,0,6,11]return = 3

The values only rise. The last value 11 has no right neighbour and is larger than 6, so the peak is at index 3.

Constraints

  • 1 <= nums.length <= 10^4
  • -10^9 <= nums[i] <= 10^9
  • nums[i] != nums[i + 1] for every valid i
  • nums has exactly one peak

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Track New Values in Sorted OrderBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Price at Query TimestampsGoogle · PHONE SCREENGoogle interview questions
  • First Missing Number in a Consecutive ArrayArista Networks · OA · PHONE SCREENArista Networks interview questions
  • Messages in an Inclusive Timestamp RangeAttentive · PHONE SCREEN · ONSITE INTERVIEWAttentive interview questions
  • First Bad Version in a Monotone ArrayMeta · PHONE SCREENMeta interview questions
  • Target Sum Across Two Sorted ArraysSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Leftmost Binary Search MatchByteDance · PHONE SCREENByteDance interview questions
  • Find the First Target IndexSuperhuman · PHONE SCREENSuperhuman interview questions
  • First Target IndexGrammarly · PHONE SCREEN
  • Ceiling Value in a Sorted ArrayPeopleStrong · PHONE SCREENPeopleStrong interview questions

Interview reports that mention this question

  • Adobe SWE Intern Interviews: 27 Experiences (Part 2 of 4)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int peakIndex(int[] nums) {
        // Write your code here.
    }
}
Checking account…