14. Longest Common Prefix

Practice Longest Common Prefix for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return the longest string that every word in strs starts with. If the words share no starting characters, return "".

Example

strs = ["flower","flow","flight"]  ->  "fl"

Constraints