You are given two arrays of strings, wordsContainer and wordsQuery.
For each string wordsQuery[i], find the string in wordsContainer that shares the longest common suffix with it.
If multiple strings in wordsContainer share the same longest suffix, choose the one with the smallest length.
If two or more such strings have the same smallest length, choose the string that appears earliest in wordsContainer.
Return an array of integers ans, where ans[i] is the index of the chosen string in wordsContainer for the query wordsQuery[i].
Constraints:
wordsContainer.length, wordsQuery.length
wordsContainer[i].length
wordsQuery[i].length
wordsContainer[i] consists only of lowercase English letters.
wordsQuery[i] consists only of lowercase English letters.
Sum of wordsContainer[i].length is, at most
Sum of wordsQuery[i].length is, at most
You are given two arrays of strings, wordsContainer and wordsQuery.
For each string wordsQuery[i], find the string in wordsContainer that shares the longest common suffix with it.
If multiple strings in wordsContainer share the same longest suffix, choose the one with the smallest length.
If two or more such strings have the same smallest length, choose the string that appears earliest in wordsContainer.
Return an array of integers ans, where ans[i] is the index of the chosen string in wordsContainer for the query wordsQuery[i].
Constraints:
wordsContainer.length, wordsQuery.length
wordsContainer[i].length
wordsQuery[i].length
wordsContainer[i] consists only of lowercase English letters.
wordsQuery[i] consists only of lowercase English letters.
Sum of wordsContainer[i].length is, at most
Sum of wordsQuery[i].length is, at most