FAST | 🔥1 LINE CODE 🚀| LAMDA EXPRESSION EXPLAINED | C++
Approach\nThis code uses the sort algorithm from the C++ Standard Library, with a lambda function that compares the ODD AND EVEN NUMBERS , a and b.\nThe lambda 
# Approach\nThis code uses the sort algorithm from the C++ Standard Library, with a lambda function that compares the ODD AND EVEN NUMBERS , a and b.\nThe lambda function returns true if a IS EVEN AND b IS ODD , and false otherwise. \nThis causes the sort algorithm to sort the vector NUMS SUCH THAT EVEN ELEMENTS OCCUR FIRST THAN ODD ELEMENTS .\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> sortArrayByParity(vector<int>& nums) {\n        sort(nums.begin(), nums.end(), [](const int& a, const int& b) { return a%2==0 && b%2==1;}) ;\n        return nums;\n    }\n};\n```\n![image.png](https://assets.leetcode.com/users/images/a7f73f54-eedf-4272-81ca-0c5dc2a32770_1675856068.5674846.png)\n
['C++']