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

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

Leetcode2053. Kth Distinct String in an Array

2022-02-02 15:54 作者:您是打尖兒還是住店呢  | 我要投稿

A?distinct string?is a string that is present only?once?in an array.

Given an array of strings?arr, and an integer?k, return?the?kth?distinct string?present in?arr. If there are?fewer?than?k?distinct strings, return?an?empty string?"".

Note that the strings are considered in the?order in which they appear?in the array.

?

Example 1:

Input: arr = ["d","b","c","b","c","a"], k = 2Output: "a"Explanation:The only distinct strings in arr are "d" and "a". "d" appears 1st, so it is the 1st distinct string. "a" appears 2nd, so it is the 2nd distinct string. Since k == 2, "a" is returned.

Example 2:

Input: arr = ["aaa","aa","a"], k = 1Output: "aaa"Explanation:All strings in arr are distinct, so the 1st string "aaa" is returned.

Example 3:

Input: arr = ["a","b","a"], k = 3Output: ""Explanation:The only distinct string is "b". Since there are fewer than 3 distinct strings, we return an empty string "".

?

Constraints:

  • 1 <= k <= arr.length <= 1000

  • 1 <= arr[i].length <= 5

  • arr[i]?consists of lowercase English letters.


Runtime:?8 ms, faster than?52.92%?of?Java?online submissions for?Kth Distinct String in an Array.

Memory Usage:?45.2 MB, less than?5.48%?of?Java?online submissions for?Kth Distinct String in an Array.


Leetcode2053. Kth Distinct String in an Array的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
六枝特区| 剑河县| 元阳县| 白沙| 汕尾市| 郓城县| 连江县| 航空| 临颍县| 万年县| 衢州市| 裕民县| 襄城县| 开原市| 云南省| 乌苏市| 开原市| 瑞丽市| 威海市| 桃江县| 昌吉市| 清徐县| 六盘水市| 兴宁市| 新龙县| 台山市| 油尖旺区| 齐齐哈尔市| 基隆市| 将乐县| 中方县| 噶尔县| 酒泉市| 新源县| 敖汉旗| 呼和浩特市| 兰溪市| 介休市| 梧州市| 黎城县| 宝清县|