Easy C++ solution using Min Heap | Fully explained
Intuition\n Describe your first thoughts on how to solve this problem. \n#### What we can\'t use\n1. Can\'t use stoi( ) function here because test case also con
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n#### What we can\'t use\n1. Can\'t use stoi( ) function here because test case also contains long long type values and stoi( ) can only be used with integer data type as the name suggest string to integer.\n\n1. Can\'t use stringstream class\n   - Stringstream class is used to convert string to int, double, or float data type.\n   - But test cases also contain long long values as string so we can\'t use that as well.\n### So how to solve this problem\nUsing `pair<int,string>` in min heap priority queue.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nI have used `pair<int,string>` in min heap priority queue.\n- Where int in `pair<int,string>` is for length of string.\n- Elements will be stored in lexicographical order when length of elements will be same else elements will be stored on the basis of length of string.\n\n# Complexity\n- Time complexity: O(n*logk)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(k)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string kthLargestNumber(vector<string>& nums, int k) {\n        priority_queue<pair<int,string>,vector<pair<int,string>>,greater<pair<int,string>>> pq;\n        int n=nums.size();\n        for(auto it:nums){\n            int len=it.length();\n            pq.push({len,it});\n            if(pq.size()>k){\n                pq.pop();\n            }\n        }\n        return pq.top().second;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']