五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

LeetCode 2734. Lexicographically Smallest String After Substring

2023-06-11 12:40 作者:您是打尖兒還是住店呢  | 我要投稿

You are given a string?s?consisting of only lowercase English letters. In one operation, you can do the following:

  • Select any non-empty substring of?s, possibly the entire string, then replace each one of its characters with the previous character of the English alphabet. For example, 'b' is converted to 'a', and 'a' is converted to 'z'.

Return?the?lexicographically smallest?string you can obtain after performing the above operation?exactly once.

A?substring?is a contiguous sequence of characters in a string.

A string?x?is?lexicographically smaller?than a string?y?of the same length if?x[i]?comes before?y[i]?in alphabetic order for the first position?i?such that?x[i] != y[i].

?

Example 1:

Input: s = "cbabc"Output: "baabc"Explanation: We apply the operation on the substring starting at index 0, and ending at index 1 inclusive. It can be proven that the resulting string is the lexicographically smallest.

Example 2:

Input: s = "acbbc"Output: "abaab"Explanation: We apply the operation on the substring starting at index 1, and ending at index 4 inclusive. It can be proven that the resulting string is the lexicographically smallest.

Example 3:

Input: s = "leetcode"Output: "kddsbncd"Explanation: We apply the operation on the entire string. It can be proven that the resulting string is the lexicographically smallest.

了解規(guī)則就好,結(jié)果我反倒被例子給搞暈了。

我跟大佬的差距有十萬八千里沒有?、


Runtime:?22 ms, faster than?80.00%?of?Java?online submissions for?Lexicographically Smallest String After Substring Operation.

Memory Usage:?48.4 MB, less than?40.00%?of?Java?online submissions for?Lexicographically Smallest String After Substring Operation.



LeetCode 2734. Lexicographically Smallest String After Substring的評論 (共 條)

分享到微博請遵守國家法律
天等县| 平利县| 宕昌县| 淮南市| 宜春市| 芜湖市| 鄂伦春自治旗| 米脂县| 宣化县| 滦南县| 泽普县| 乐山市| 开江县| 通辽市| 府谷县| 苏尼特右旗| 池州市| 宁河县| 江都市| 宜兰市| 遂平县| 专栏| 神农架林区| 嘉兴市| 和政县| 南靖县| 拜城县| 嘉义县| 张家港市| 台南县| 仙游县| 景洪市| 公安县| 华池县| 鲁甸县| 池州市| 五原县| 娄底市| 开远市| 连云港市| 康平县|