C++ | Solution with Explanation | Sorting  (Lambda Expression)
This problem can be solved easily using inbuilt sort function with custom comparator. \n\nSince, we know that numbers are stored in string format and length of 
This problem can be solved easily using inbuilt sort function with custom comparator. \n\nSince, we know that numbers are stored in string format and length of thoes numbers is in range of [1, 100] which is larger than the range of int and long long int. So, we need to compare in form of strings itself for sorting. \n\nComparsion in string is done in lexicographical order (i.e similar to ordering in Dictionary) . For eg if a = "1000" and b = "20", then b > a lexicographically.\n\nTherefore in order to compare any two numbers a, b in format of strings we need to follow these two step :\n**Step1** Check length of both strings, if not equal than the string with larger size will be greater number, if equal than proceed to step (ii)\n**Step2** Compare both the strings lexicographically.\n\n```\nclass Solution {\npublic:\n    string kthLargestNumber(vector<string>& nums, int k) {\n        int n = nums.size();\n        sort(nums.begin(), nums.end(), [](string a, string b) { //lambda expression\n            if(a.size() == b.size()) {\n                return a < b;   //lexicographical comparision\n            }\n            return a.size() < b.size();\n        });\n        return nums[n - k];\n    }\n};\n```\nLambda Expression Reference : https://docs.microsoft.com/en-us/cpp/cpp/lambda-expressions-in-cpp?view=msvc-160 \n\nTakeaways :\n(i) Integer Comparision in format of string\n(ii) Lambda Expression\n\n**Please Upvote if found useful**
['C', 'C++']