Problem Solving/LeetCode
2023.06.09 Today's Challenge
fabichoi
2023. 6. 9. 23:45
https://leetcode.com/problems/find-smallest-letter-greater-than-target/
Find Smallest Letter Greater Than Target - LeetCode
Can you solve this real interview question? Find Smallest Letter Greater Than Target - You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Retu
leetcode.com
올만에 매우 쉬운 문제
class Solution:
def nextGreatestLetter(self, letters: List[str], target: str) -> str:
for l in letters:
if l > target:
return l
return letters[0]
반응형