You are given an array of strings words.
Your task is to determine the longest common prefix shared among all strings in the array.
If there is no shared prefix, return an empty string "".
A common prefix is the portion at the beginning of each word that appears exactly the same across all given strings.
Input: words = ["interview", "internet", "internal", "interval"]
Output: "inter"
Explanation:
All words share the prefix "inte" before they start to differ.
Input: words = ["apple", "application", "apex"]
Output: "ap"
Explanation:
All three words start with "ap", but the next letters differ (p, p, and e).
Accepted:
Submission: