File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 273
273
733|[ Flood Fill] ( ./0733-flood-fill.js ) |Easy|
274
274
735|[ Asteroid Collision] ( ./0735-asteroid-collision.js ) |Medium|
275
275
739|[ Daily Temperatures] ( ./0739-daily-temperatures.js ) |Medium|
276
+ 744|[ Find Smallest Letter Greater Than Target] ( ./0744-find-smallest-letter-greater-than-target.js ) |Easy|
276
277
745|[ Prefix and Suffix Search] ( ./0745-prefix-and-suffix-search.js ) |Hard|
277
278
746|[ Min Cost Climbing Stairs] ( ./0746-min-cost-climbing-stairs.js ) |Easy|
278
279
747|[ Largest Number At Least Twice of Others] ( ./0747-largest-number-at-least-twice-of-others.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 744. Find Smallest Letter Greater Than Target
3
+ * https://leetcode.com/problems/find-smallest-letter-greater-than-target/
4
+ * Difficulty: Easy
5
+ *
6
+ * You are given an array of characters letters that is sorted in non-decreasing order,
7
+ * and a character target. There are at least two different characters in letters.
8
+ *
9
+ * Return the smallest character in letters that is lexicographically greater than target.
10
+ * If such a character does not exist, return the first character in letters.
11
+ */
12
+
13
+ /**
14
+ * @param {character[] } letters
15
+ * @param {character } target
16
+ * @return {character }
17
+ */
18
+ var nextGreatestLetter = function ( letters , target ) {
19
+ return letters . find ( l => l > target ) || letters [ 0 ] ;
20
+ } ;
You can’t perform that action at this time.
0 commit comments