You are given an integer n, an array of strings words, and an array of integers groups, both of length n.
The Hamming distance between two strings of equal length is defined as the number of positions at which the corresponding characters are different.
You need to select the longest subsequence of indices
groupsgroups
words.length words.length
The Hamming distance between wordswords
Return an array of strings containing the elements of words corresponding to the chosen sequence of indices. If there are multiple valid subsequences of the maximum length, you may return any of them.
Note: A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
Constraints:
words.length groups.length
words[i].length
groups[i]
words consists of distinct strings.
words[i] consists of lowercase English letters.
You are given an integer n, an array of strings words, and an array of integers groups, both of length n.
The Hamming distance between two strings of equal length is defined as the number of positions at which the corresponding characters are different.
You need to select the longest subsequence of indices
groupsgroups
words.length words.length
The Hamming distance between wordswords
Return an array of strings containing the elements of words corresponding to the chosen sequence of indices. If there are multiple valid subsequences of the maximum length, you may return any of them.
Note: A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
Constraints:
words.length groups.length
words[i].length
groups[i]
words consists of distinct strings.
words[i] consists of lowercase English letters.