Kth Distinct String In Array: Return Kth Unique String
Find kth distinct string in array: create frequency map, collect strings with count 1, return k-th one if exists, else empty string. PHP solution provided.
2053. Kth Distinct String in an Array Easy 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 = 2 Output: "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...
