✅C++ || EASY Two Pointers
Code\n\nclass Solution {\npublic:\n    int numRescueBoats(vector<int>& people, int limit) {\n        sort(people.begin(),people.end());\n        int i=0,j=peopl
# Code\n```\nclass Solution {\npublic:\n    int numRescueBoats(vector<int>& people, int limit) {\n        sort(people.begin(),people.end());\n        int i=0,j=people.size()-1;\n        int ans=0;\n        while(i<=j){\n            ans++;\n            if(people[i] + people[j] <=limit){\n                i++;\n            }\n            j--;\n        }\n        return ans;\n    }\n};\n```\n![upvote (3).jpg](https://assets.leetcode.com/users/images/014d7e4c-f7e8-4df0-aef2-62804a6acc83_1680497831.2382014.jpeg)\n
['C++']