Problems requiring a next larger element in a sorted array

Hello dear Leetcode community,

I was asked to write a function that for a given array M and a number num returns the first element that is strictly larger than num. For example, for M = [1, 2, 3, 4, 4, 4, 4, 7], num = 5 the answer will be 7, because 7 is the first element in the array that is larger than 5.

I seem to have written the code and now I want to test it.

Question: Could you please give me any problem numbers here on Leetcode that require this function so I could test it. Obvioulsy, I've run some tests including various edge cases, but I may have missed something and I want to make sure that my function works well on any tests. So what are the problems that may require that function?

I appreciate any help.

Comments (0)