words and a number k. Call a word a loner if it occurs in the list exactly once.
Scan the list from left to right and return the k-th loner you meet (counting from one). If there are fewer than k loners, return the empty string "".words=["sun", "cat", "sky", "cat", "owl"], k=2 → 'sky'
The words seen exactly once are "sun", "sky" and "owl", in that order. The second one is "sky".
words=["ab", "ab", "x"], k=2 → ''
The only word without a repeat is "x"; there is no second one, so the answer is an empty string.
words=["q", "r", "s"], k=3 → 's'
words[i] consists of lowercase English letterswords=["sun", "cat", "sky", "cat", "owl"], k=2
'sky'
Run checks the first 3 tests in your browser. Submit checks all 107 tests on the server, hidden ones included.