Sortedlist py3
Kinda feel like cheating with sortedlist \n\n# Code\npython3 []\nfrom sortedcontainers import SortedList\nclass Solution:\n    def resultArray(self, nums: List[
Kinda feel like cheating with sortedlist \n\n# Code\n```python3 []\nfrom sortedcontainers import SortedList\nclass Solution:\n    def resultArray(self, nums: List[int]) -> List[int]:\n        arr1,arr2 = [nums[0]],[nums[1]]\n        sl1,sl2 = SortedList(arr1),SortedList(arr2)\n        n1,n2 = 1,1\n        n = len(nums)\n        for i in range(2,n):\n            a = nums[i]\n            g1 = n1 - sl1.bisect_right(a)\n            g2 = n2 - sl2.bisect_right(a)\n            if g1 > g2:\n                arr1.append(a)\n                sl1.add(a)\n                n1 += 1\n            elif g1 < g2:\n                arr2.append(a)\n                sl2.add(a)\n                n2 += 1\n            elif n1<n2:\n                arr1.append(a)\n                sl1.add(a)\n                n1 += 1\n            elif n1>n2:\n                arr2.append(a)\n                sl2.add(a)\n                n2 += 1\n            else:\n                arr1.append(a)\n                sl1.add(a)\n                n1 += 1\n        return arr1+arr2\n\n\n\n        \n```
['Ordered Set', 'Python3']