This should by no means be a Medium question
\tclass Solution {\n\tpublic:\n\t\tvector numMovesStonesII(vector& stones) {\n\t\t\tsort(stones.begin(),stones.end());\n\t\t\tint n=stones.size();\n\t\t\tint MA
\tclass Solution {\n\tpublic:\n\t\tvector<int> numMovesStonesII(vector<int>& stones) {\n\t\t\tsort(stones.begin(),stones.end());\n\t\t\tint n=stones.size();\n\t\t\tint MAX=0;\n\t\t\tint MIN=INT_MAX;\n\t\t\tint a=stones.back()-stones[1]+1-(n-1);\n\t\t\tint b=stones[n-2]-stones[0]+1-(n-1);\n\t\t\tint j=0;\n\t\t\tMAX=max(a,b);\n\t\t\tfor(int i=0;i<n;i++){\n\t\t\t\twhile(j<n && stones[j]-stones[i]+1<n){\n\t\t\t\t\tj++;\n\t\t\t\t}\n\t\t\t\tif(j>=n){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tint gap;\n\t\t\t\tif(stones[j]-stones[i]+1==n){\n\t\t\t\t\tgap=n-(j-i+1);\n\t\t\t\t}\n\t\t\t\telse if(j-1-i+1==n-1){\n\t\t\t\t\tgap=2;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tgap=n-(j-1-i+1);\n\t\t\t\t}\n\t\t\t\tMIN=min(MIN,gap);\n\t\t\t}\n\t\t\treturn {MIN,MAX};\n\t\t}\n\t};
['C', 'Sliding Window', 'C++']