Level: Junior-Level
Round: Phone Screen · Type: Coding · Difficulty: 4/10 · Duration: 60 min · Interviewer: Neutral
Topics: Arrays
Location: San Francisco Bay Area
Interview date: 2025-10-09
This was a 60-minute interview with two questions.
The first question was very easy, and I solved it within a minute.
The second question involved finding the minimum number of unstable points (spikes and dips) in an array after adjusting at most one element.
The second question was:
Given an integer array, a 'spike' is defined as an element strictly greater than its adjacent left and right elements. A 'dip' is defined as an element strictly less than its adjacent left and right elements. The first and last elements of the array are neither spikes nor dips.
A spike and a dip are collectively referred to as an 'unstable point'.
Now, by adjusting at most one element in the array, find the minimum total number of unstable points in the array.