Nearest larger number for index in an array

medium