Maximum of Difference Between Allotted Seats.
Take Difference between Neighbouring Alloted Seats. The Max of difference will be the required Distance for each New Seat.\n\nclass ExamRoom:\n\n    def __init_
Take Difference between Neighbouring Alloted Seats. The Max of difference will be the required Distance for each New Seat.\n```\nclass ExamRoom:\n\n    def __init__(self, n: int):\n        self.c=0\n        self.akk=[]\n        self.n=n\n    def seat(self) -> int:\n        if(self.c==0):\n            self.akk.append(0)\n            self.c+=1\n            return 0\n            \n        first=self.akk[0]-0\n        last=self.n-self.akk[-1]-1\n        midmax=0\n        midmaxindex=0\n        for i in range(1,len(self.akk)):\n            if(((self.akk[i]-self.akk[i-1])//2) > midmax):\n                midmax=((self.akk[i]-self.akk[i-1])//2)\n                midmaxindex=midmax+self.akk[i-1]\n        if(first>=last and first>=midmax):\n            self.c+=1\n            self.akk.insert(0,0)\n            return 0\n            \n        elif(last>first and last>midmax):\n            self.c+=1\n            self.akk.append(self.n-1)\n            return self.n-1\n            \n        else:\n            self.c+=1\n            bisect.insort(self.akk,midmaxindex)\n            return midmaxindex\n                    \n        \n    def leave(self, p: int) -> None:\n        self.akk.pop(self.akk.index(p))\n        self.c-=1\n```
[]