classSolution { public: intmaxConsecutive(int bottom, int top, vector<int>& special){ sort(special.begin(), special.end()); int res = 0; int n = special.size(); for(int i = 1; i < special.size(); i ++){ res = max(res, special[i] - special[i - 1] - 1); } // 两端的楼层计算 res = max(res, special[0] - bottom); res = max(res, top - special[n - 1]); return res; } };