Načítání úlohy…
In lists, you often need to find items that appear only once, such as unique names or rare commands. Write a function kth_distinct that finds the k-th string that appears exactly once in arr. Keep the original order of appearance when counting distinct strings. If there are fewer than k distinct strings, return an empty string.
["d", "b", "c", "b", "c", "a"], 2"a"["aaa", "aa", "a"], 1"aaa"["a", "b", "a"], 3""def kth_distinct(arr: list[str], k: int) -> str:
Přihlaste se, abyste viděli historii odevzdání
Přihlásit sePřihlaste se, abyste mohli použít AI mentora
Přihlásit se["d","b","c","b","c","a"], 2"a"["aaa","aa","a"], 1"aaa"["a","b","a"], 3""["x","y","z"], 2"y"["a","a","b"], 1"b"["one","two","two","one","three"], 1"three"