【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 如果找不到,返回第一个值

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,449评论 0 10
  • 2017年9月1日觉察日记+尚军伟+9号 最近心情起起伏伏,因为调换部门的事情并没有像预想的那么顺利,所以有些情绪...
    浩子爸阅读 353评论 4 6
  • 思考过这个问题么?你眼中的世界,是世界的全貌么? 显然并不是。人是一种认知动物,对于世界的认识往往只局限于自己的观...
    文俊粥阅读 4,391评论 2 9
  • 已三十岁,最近经常会扪心自问:我喜欢什么?擅长什么?我的梦想是什么?似乎很遗憾,我不知道。我喜欢什么呢?阅读算不算...
    秋欣62阅读 338评论 0 0
  • 宝贝今天早上6点就起床了,我说你再睡会去吧,他说我要整理一下书,你们老师说了只拿语文就可以了,儿子急了说万一我们学...
    爱护小树苗阅读 71评论 0 0