Given a list of oxygen levels recorded by astronauts in a space station over time, find the index of the highest oxygen level reading that is greater than or equal to its neighboring readings. If no such index exists, return -1.
Explanation: Step-by-step: with input [1, 2, 3, 4, 5, 4, 3, 2, 1], we iterate through the array and find that the highest oxygen level reading is 5, which is not greater than or equal to its neighboring readings. Therefore, the output is -1.
Explanation: Step-by-step: with input [5, 5, 5, 5, 5], we iterate through the array and find that all oxygen level readings are equal. Therefore, the output is 0.
Master coding challenges related to Arrays and solve the [Backup] Astronaut's Oxygen Level Detector problem optimally.
No dry run loaded.
🚀 Practice this problem
Run code, get AI hints & track streak