JAVA SOLUTION | WITH EXPLAINATION
\nif (people.length == 0)\n\t\t\treturn 0;\n\n\t\tint first, last, numOfBoats = 0;\n\t\tArrays.sort(people);\n\t\tfirst = 0;\n\t\tlast = people.length - 1;\n\t\
```\nif (people.length == 0)\n\t\t\treturn 0;\n\n\t\tint first, last, numOfBoats = 0;\n\t\tArrays.sort(people);\n\t\tfirst = 0;\n\t\tlast = people.length - 1;\n\t\t\n\t\t/*   Concept of heavy on the right and light on the left\n\t\t * \tWe will try to adjust most lightiest person with the most heaviest person\n\t\t *  if the heavy person on the right mathces with the left person than they will go in a boat\n\t\t *  else there is no point of checking further as the array is increasing from lightest person\'s side\n\t\t *  THE MAIN CONCEPT IS DECREMENT THE LAST AS HEAVY PERSON CAN TRAVEL ALON\n\t\t *  OR LOOK FOR A MATCH WITH LIGHT PERSON UNTIL THE LIGHT AND FAT PERSON ARE SAME\n\t\t * \n\t\t *  Step 1 if a match is found such that the sum of weight of light and heavy is less than or equal to \n\t\t *  given limit then this pair will go and just increase the first pointer for now\n\t\t *  Step 2 if there is a case when first and last becomes equal this means that there is only one person and he will \n\t\t *  travel by himself only just increment the number of Boats and exit out of loop\n\t\t *  Step 3 here we will decrement the last and increase the number of boats required\n\t\t * \n\t\t */\n\t\twhile (first <= last) {\n\t\t\tif (people[first] + people[last] <= limit) {\n\t\t\t\tfirst++;\n\n\t\t\t}else if (first == last) {\n\t\t\t\tnumOfBoats++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlast--;\n\t\t\tnumOfBoats++;\n```
[]