Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If we reverse the strings, the problem changes to finding the longest common prefix.
Build a Trie, each node is a letter and only saves the best word’s index in each node, based on the criteria.
Solve with full IDE support and test cases