One novel solution to the easy problem
1 | class Solution: |
It works because the sort function will sort the strings by prefix. So if the last string has the same prefix with the first string, it means that all the string within the range would satisfy the property of common prefix.