1763. Longest Nice Substring
https://leetcode.com/problems/longest-nice-substring
Description
A string s
is nice if, for every letter of the alphabet that s
contains, it appears both in uppercase and lowercase. For example, "abABB"
is nice because 'A'
and 'a'
appear, and 'B'
and 'b'
appear. However, "abA"
is not because 'b'
appears, but 'B'
does not.
Given a string s
, return the longest substring of s
that is nice. If there are multiple, return the substring of the earliest occurrence. If there are none, return an empty string.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= s.length <= 100
s
consists of uppercase and lowercase English letters.
ac
Previous1762. Buildings With an Ocean ViewNext1764. Form Array by Concatenating Subarrays of Another Array
Last updated