Given a list of strings, return the longest prefix that is common to all strings in the list. If no common prefix exists, return an empty string.
Example 1
Input: [apple, application, apex]
Output: ap
Explanation: All strings share ap as the longest common prefix.
Example 2
Input: [cat, catalog, cater]
Output: cat
Explanation: All strings share cat as the longest common prefix.
Example 3
Input: [alpha, beta, gamma]
Output: ''
Explanation: No common prefix among all strings.
Constraints
Case 1
Input: ['interview', 'internet', 'internal']
Expected: 'inte'
Case 2
Input: ['tree', 'trunk', 'track']
Expected: 'tr'
Case 3
Input: ['one', 'only', 'once']
Expected: 'on'
Case 4
Input: ['hello', 'world', 'python']
Expected: ''
Case 5
Input: ['a', 'ab', 'abc']
Expected: 'a'