🎊 JAVA full Explained✈️ Easy Solution 🚀🎊
Intuition\n Describe your first thoughts on how to solve this problem. \nAim :-  Minimize the number of rescue boats which carry out peoples whith their weight 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n**Aim :-**  Minimize the number of rescue boats which carry out peoples whith their weight limits.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUse two pointers in sorted Array.\n1) Front pointer starts from **starting** of Array (i.e \'i\')\n2) Last (rare) pointer starts from **ending** of Array (i.e \'j\') \n# Complexity\n- Time complexity: O(n log n)\n\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int numRescueBoats(int[] people, int limit) {\n        //count the no. of boats are needed.\n        int count = 0;\n\n        //sort the array in ascending order (2,5,6,7)\n        Arrays.sort(people); \n\n        //If array is empty\n        if (people == null){\n            return 0;\n        }\n        //Initialise 2 ponters (i.e i start from 0 and j starts from ending of array.)\n        int i = 0;\n        int j = people.length - 1;\n\n        //Continue in loop until i(starting of array) is less or    equal to j(ending of array)\n        while(i <= j){\n            //check whether 2 peoples have weight equal or less than given limit \n            if(people[i] + people[j] <= limit){\n                i++;//increase the front pointer\n            }\n            j--;// decrement rare(last) pointer\n\n            //Increase the no. of boats which are needed\n            count++;\n        }\n        return count;\n    }\n}\n```
['Java']