【Leetcode】744. Find Smallest Letter Greater Than Target

Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list that is larger than the given target.

Letters also wrap around. For example, if the target is target = 'z' and letters = ['a', 'b'], the answer is 'a'.

1 因为是sorted的,所以只要依次遍历,找到第一个比target大的数,就是所求

2 如果找不到,返回第一个值

你可能感兴趣的:(【Leetcode】744. Find Smallest Letter Greater Than Target)