Python | Heap | Two solutions, one of which surprisingly did not TLE
First approach. Kind of dissapointed it did not TLE\nI was expecting this solution to TLE, but didn\'t. I think we need stronger test cases, at least for Python
# First approach. Kind of dissapointed it **did not TLE**\nI was expecting this solution to TLE, but didn\'t. I think we need stronger test cases, at least for Python, here.\n\nWe convert each string to an integer, and then use a heap to find the desired one. We convert back to a string to return the result. **This approach would definitely overflow in *not Python*** since the integers in `nums` can have up to `100` digits (i.e. we need *336*-bit integers to store them all safely).\n\n```\nclass Solution:\n    def kthLargestNumber(self, nums: List[str], k: int) -> str:\n        heap = [-1] * k\n        \n        for num in nums:\n            heappushpop(heap, int(num))\n            \n        return str(heap[0])\n```\n\n# Better approach: sort by size, then lexicographically\nThis is a much better solution that, instead of converting each string into an integer, compares the numbers by size, and then lexicographically if they have the same size. This should be ok in *not Python*.\n\n```\nclass Solution:\n    def kthLargestNumber(self, nums: List[str], k: int) -> str:\n        heap = [(0, "")] * k\n        \n        for num in nums:\n            heappushpop(heap, (len(num), num))\n            \n        return heap[0][1]\n```
['Heap (Priority Queue)', 'Python']