Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day30 q2: Find Smallest Letter Greater Than Target #619

Open
sumiranverma opened this issue Jan 27, 2024 · 3 comments
Open

Day30 q2: Find Smallest Letter Greater Than Target #619

sumiranverma opened this issue Jan 27, 2024 · 3 comments

Comments

@sumiranverma
Copy link
Contributor

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.

Return the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character in letters.

Example 1:

Input: letters = ["c","f","j"], target = "a"
Output: "c"
Explanation: The smallest character that is lexicographically greater than 'a' in letters is 'c'.

Example 2:

Input: letters = ["c","f","j"], target = "c"
Output: "f"
Explanation: The smallest character that is lexicographically greater than 'c' in letters is 'f'.

Example 3:

Input: letters = ["x","x","y","y"], target = "z"
Output: "x"
Explanation: There are no characters in letters that is lexicographically greater than 'z' so we return letters[0].

Constraints:

  • 2 <= letters.length <= 10^4
  • letters[i] is a lowercase English letter.
  • letters is sorted in non-decreasing order.
  • letters contains at least two different characters.
  • target is a lowercase English letter.

Problem Link

https://leetcode.com/problems/find-smallest-letter-greater-than-target/

@Tech-neophyte
Copy link
Contributor

Please assign this question to me :)

@Anomasingh
Copy link
Contributor

Anomasingh commented Jan 27, 2024

Please assign this question to me @bh-g

@avanimathur
Copy link
Contributor

Please assign it to me @bh-g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants