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. 🐳
buddyList = [0, 1, 4, 3, 2, 5] target = 1 return = 2
Unknown for nowpublic int tDeskGreaterThanThreshold(int[] buddyList, int target) {
// write your code here
}