Given a string licensePlate and an array of strings words, find the shortest completing word in words.
A completing word is a word that contains all the letters in licensePlate, ignoring case. Characters in licensePlate that are not letters (such as digits and spaces) are ignored. If a letter appears multiple times in licensePlate, it must occur at least that many times in the completing word.
Return the shortest completing word. If there are multiple shortest completing words with the same minimum length, return the first one that appears in words.
Constraints:
licensePlate.length
licensePlate contains digits, letters (uppercase or lowercase), or space ' '.
words.length
words[i].length
words[i] consists of lowercase English letters.
Given a string licensePlate and an array of strings words, find the shortest completing word in words.
A completing word is a word that contains all the letters in licensePlate, ignoring case. Characters in licensePlate that are not letters (such as digits and spaces) are ignored. If a letter appears multiple times in licensePlate, it must occur at least that many times in the completing word.
Return the shortest completing word. If there are multiple shortest completing words with the same minimum length, return the first one that appears in words.
Constraints:
licensePlate.length
licensePlate contains digits, letters (uppercase or lowercase), or space ' '.
words.length
words[i].length
words[i] consists of lowercase English letters.