Algorithm · Capital One · Easy
You are given an integer array nums. Scanning from the left, locate the earliest element that is a strict local minimum, meaning the value directly before it and the value directly after it are each strictly greater than it, and return that element's value. Formally, look for the smallest index i with 1 nums[i] \quad \text{and} \quad nums[i+1] > nums[i] $$ If no index meets this condition, return -1. Input Format Line 1: the integer n. Line 2: n integers, the contents of…