Priority_queue without comparator
Thanks to Bulls_eye for this approach\n# Intuition\n\nWhat we can\'t use\n1.Can\'t use stoi( ) function here because test case also contains long long type valu
Thanks to Bulls_eye for this approach\n# Intuition\n\nWhat 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\n2.Can\'t use stringstream class\n\nStringstream class is used to convert string to int, double, or float data type.\nBut test cases also contain long long values as string so we can\'t use that as well.\nSo how to solve this problem\n## `Using pair<int,string> in min heap priority queue.`\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n- Where int in pair<int,string> is for length of string.\n\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- When arranging strings lexicographically, you\'re comparing them character by character from left to right. In this case, when comparing the strings "3" and "13", you would compare their first characters, which are \'3\' and \'1\'. Since \'1\' comes before \'3\' in the ASCII character set, "13" would come before "3" lexicographically.\n\n# Complexity\n- Time complexity: 0(Nlogk)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:0(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        \n        \n        priority_queue<pair<int,string>,vector<pair<int,string>>,greater<pair<int,string>>>pq;\n\n        for(int i = 0 ; i < nums.size() ;i++)\n        {\n            int len = nums[i].length();\n            pq.push({len,nums[i]});\n\n            if(pq.size() > k)\n            {\n                pq.pop();\n            }\n        }\n\n       return  pq.top().second;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']