👍👍Understandable solution using sorting, Two pointers, Greedy✅✅
Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    int numRescueBoats(vector<int>& people, int limit)
# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int numRescueBoats(vector<int>& people, int limit) {\n        sort(people.begin(),people.end());\n        int i =0;\n        int j = people.size()-1;\n        int ans = 0;\n        while(i<=j)\n        {\n            if(people[i]+people[j]<=limit)\n            {\n                i++;\n            }\n            ans++;\n            j--;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'Greedy', 'Sorting', 'C++']