Longest Common Suffix
Problem statement
Given an array of strings words, return the longest string that is a suffix of every word. Return the empty string when there is no common suffix.
Function
longestCommonSuffix(words: String[]) → StringExamples
Example 1
words = ["running","jogging","walking"]return = "ing"Example 2
words = ["cat","dog"]return = ""Constraints
1 <= words.length <= 1000.0 <= words[i].length <= 1000.- The total number of characters is at most
100000.