Consider a list of integers <1,5,10>
(assume sorted in ascending fashion).
Given an integer, say, key = 6
, is there a utility method that returns the smallest element after key
(in this case it would be 10)?
NB: Looping through the elements in the list and comparing it with key
is an obvious way to do it, but I'm just wondering if there exist a utility method to do the same thing :)