Simple c++ solution with detailed explaintion
\n/*\n\tIf we are able to form any number in the range [s,e].\n\tIf we take a number A and include it with every number of the range [s,e]. We will be able to f
```\n/*\n\tIf we are able to form any number in the range [s,e].\n\tIf we take a number A and include it with every number of the range [s,e]. We will be able to form ant number in the range[s+A,e+A].\n\tNow lets consider the two ranges:\n\t\t[s,e] - formed without taking A\n\t\t[s+A,e+A] - formed by taking A with every number in the range [s,e]\n\tSo, the range of numbers we can form with or without taking A is [s,e] U [s+A,e+A]\n\tIf s+A <= e+1, then [s,e] U [s+A,e+A] will form a continous sequence [s,e+A]\n\tNow suppose s+A > e+1, this means we cannot form e+1\n\t\tNow lets take another number B >= A.\n\t\tThe smallest number we can form considering the range [s,e] with B is s+B\n\t\tBut B >= a => s+B >= s+A > e+1 => s+B > e+1. Thie means we cannot form e+1 by considering B or rather any number greater than A.\n\t\tThis implies e+1 will be the smallest number which cannot be formed considering the elements of the array.\n\tIf we keep forming continous sequence still at the end we will get e+1 as the required answer.\t\t\n*/\nint getMaximumConsecutive(vector<int>& coins){\n\t// To implement the above algorithm we need to sort the array so that each number is greater than or equal to the previous number\n\tsort(coins.begin(),coins.end());\n\t// 0 can always be formed by taking no elements\n\tif(coins[0] != 1)\n\t\treturn 1;\n\t// Setting the initial range as [0,1] and then implementing the above algorithm\n\tint s = 0, e = 1, n = coins.size();\n\tfor(int i=1;i<n;i++){\n\t\tint l = s + coins[i], r = e + coins[i];\n\t\tif(l <= e + 1){\n\t\t\te = r;\n\t\t}\n\t\telse{\n\t\t\treturn e + 1;\n\t\t}\n\t}\n\treturn e + 1;        \n}\n```
[]