Tap here to switch tabs
Problem
Submissions

Problem: Shortest Uncommon Substring in an Array

Try to solve the Shortest Uncommon Substring in an Array problem.

Statement

Given an array of strings arr of size n, determine an array of strings answer of length n such that for each index i:

  • answer[i] is the shortest substring of arr[i] that does not appear as a substring in any other string in arr.

  • If there are multiple such shortest substrings, answer[i] is the lexicographically smallest one.

  • If no such substring exists, answer[i] is an empty string "".

Return the array answer.

Constraints:

  • n ==== arr.length

  • 2≤2 \leq n ≤100\leq 100

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

  • arr[i] consists only of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Shortest Uncommon Substring in an Array

Try to solve the Shortest Uncommon Substring in an Array problem.

Statement

Given an array of strings arr of size n, determine an array of strings answer of length n such that for each index i:

  • answer[i] is the shortest substring of arr[i] that does not appear as a substring in any other string in arr.

  • If there are multiple such shortest substrings, answer[i] is the lexicographically smallest one.

  • If no such substring exists, answer[i] is an empty string "".

Return the array answer.

Constraints:

  • n ==== arr.length

  • 2≤2 \leq n ≤100\leq 100

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

  • arr[i] consists only of lowercase English letters.