Solving Shortest Completing Word in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

It is guaranteed an answer exists. If there are multiple answers, return the one that occurs first in the array.

Example 1:

Input: licensePlate = "1s3 PSt", words = ["step", "steps", "stripe", "stepple"]
Output: "steps"
Explanation: The smallest length word that contains the letters "S", "P", "S", and "T".
Note that the answer is not "step", because the letter "s" must occur in the word twice.
Also note that we ignored case for the purposes of comparing whether a letter exists in the word.

Example 2:

Input: licensePlate = "1s3 456", words = ["looks", "pest", "stew", "show"]
Output: "pest"
Explanation: There are 3 smallest length words that contains the letters "s".
We return the one that occurred first.


See the full details of the problem Shortest Completing Word at LeetCode

Originally posted at: