Tap here to switch tabs
Problem
Submissions

Problem: Kth Distinct String in an Array

med
30 min
Try to solve the Kth Distinct String in an Array problem.

Statement

A distinct string is a string that occurs exactly once in an array.

Given an array of strings arr and an integer k, return the kextthk^{ ext{th}} distinct string that appears in arr. If arr contains fewer than k distinct strings, return an empty string "".

Note that strings are evaluated in the order of their appearance in arr.

Constraints:

  • 1≤1 \leq k ≤\leq arr.length ≤1000\leq 1000

  • 1≤1 \leq arr[i].length ≤5\leq 5

  • arr[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Kth Distinct String in an Array

med
30 min
Try to solve the Kth Distinct String in an Array problem.

Statement

A distinct string is a string that occurs exactly once in an array.

Given an array of strings arr and an integer k, return the kextthk^{ ext{th}} distinct string that appears in arr. If arr contains fewer than k distinct strings, return an empty string "".

Note that strings are evaluated in the order of their appearance in arr.

Constraints:

  • 1≤1 \leq k ≤\leq arr.length ≤1000\leq 1000

  • 1≤1 \leq arr[i].length ≤5\leq 5

  • arr[i] consists of lowercase English letters.