Description
Solutions
Submission
Buddies Greater than Target 🦋

Once upon a time, in a realm of integers, there was a quest to find the first spot where the landscape changed dramatically. The adventurers were given a map called "numbers," guiding them through this numerical landscape. Their mission was to discover the very first location where the terrain rose sharply, where three consecutive points, represented by "numbers[i]," "numbers[i + 1]," and "numbers[i + 2]," stood higher than a certain threshold.

As they journeyed through this numerical expanse, they diligently searched for a place where the terrain shifted abruptly, where three consecutive points towered above the threshold. Should they find such a place, they would mark the index "i" and return triumphantly. Yet, if no such spot existed, they would sadly return with news of their quest's failure, marked by a return value of -1.

Their journey was not about speed, but about thorough exploration. So long as their method did not exceed a complexity greater than O(numbers.length2), they could traverse the landscape within the allotted time.

For original prompt, please refer to source image. 🐳

Example 1:

Input:  buddyList = [0, 1, 4, 3, 2, 5], target = 1
Output: 2
Explanation:
At the starting point, index 0, the trio of companions (buddyList[0], buddyList[1], buddyList[2]) includes 0 and 1, neither of which surpasses the threshold of 1. Moving to index 1, the companionship of (buddyList[1], buddyList[2], buddyList[3]) comprises 1, 4, and 3. However, only 4 exceeds the target value. It's not until index 2 that the trio (buddyList[2], buddyList[3], buddyList[4]) emerges, featuring all friends whose values surpass the threshold. Thus, the answer lies at index 2, where the landscape shifts dramatically.
Constraints:
    Unknown for now
Thumbnail 0
Thumbnail 1
Testcase

Result
Case 1

input:

output: