#3093

Longest Common Suffix Queries

master · 1830 · lc hard +32 · 35.9% accepted · 191 likes · top 14%

Description

Given string arrays wordsContainer and wordsQuery, for each query word find the index of the string in wordsContainer with the longest common suffix. Among ties, choose the shortest string; if still tied, choose the one appearing earliest in wordsContainer. Return the resulting index array.

Code

1
2
3