Python Elegant & Short | 98.51% faster | Two solutions | O(n*log(n)) and O(n)
\n\n\tclass Solution:\n\t\t"""\n\t\tTime:   O(226log(226))\n\t\tMemory: O(226)\n\t\t"""\n\n\t\tdef greatestLetter(self, s: str) -> str:\n\t\t\tletters = set(s)\
![image](https://assets.leetcode.com/users/images/9b573c32-d4d5-4d53-8866-0c98b100fefc_1660424704.340886.png)\n\n\tclass Solution:\n\t\t"""\n\t\tTime:   O(2*26*log(2*26))\n\t\tMemory: O(2*26)\n\t\t"""\n\n\t\tdef greatestLetter(self, s: str) -> str:\n\t\t\tletters = set(s)\n\n\t\t\tfor ltr in sorted(letters, reverse=True):\n\t\t\t\tif ltr.isupper() and ltr.lower() in letters:\n\t\t\t\t\treturn ltr\n\n\t\t\treturn \'\'\n\n\n\tclass Solution:\n\t\t"""\n\t\tTime:   O(2*26)\n\t\tMemory: O(2*26)\n\t\t"""\n\n\t\tdef greatestLetter(self, s: str) -> str:\n\t\t\tletters = set(s)\n\t\t\tgreatest = \'\'\n\n\t\t\tfor ltr in letters:\n\t\t\t\tif ltr.isupper() and ltr.lower() in letters:\n\t\t\t\t\tgreatest = max(ltr, greatest)\n\n\t\t\treturn greatest\n
['Python', 'Python3']