Practice Kth Distinct String in an Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Kth Distinct String in an Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
arr = ["d","b","c","b","c","a"], k = 2
"a"
# Example 2
arr = ["aaa","aa","a"], k = 1
"aaa"
# Example 3
arr = ["a","b","a"], k = 3
""
Constraints
Related LeetCode Problems
Practice more problems similar to Kth Distinct String in an Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.