we can use Binary Indexed Tree(BIT)/Fenwick Tree to solve this problem, the (Value and (Value xor (Value - 1))), O(nlogn) Solution:

```
class Solution:
# @param {integer[][]} buildings
# @return {integer[][]}
def CalcBit(self,Value):
return (Value & (Value ^(Value -1)))
def Add(self,R,H):
while R > 0:
self.TreeCount[R] = max(self.TreeCount[R],H)
R -= self.CalcBit(R)
def Find(self,L):
Ret = 0
while L <= self.INT_MAX:
Ret =max(self.TreeCount[L],Ret)
L += self.CalcBit(L)
return Ret
def getSkyline(self, buildings):
Ret = []
High_Now = 0
TB = []
for x in range(len(buildings)):
TB.append([buildings[x][0],1,x])
TB.append([buildings[x][1],2,x])
TB.sort()
Dict = {}
ToT = 0
for Num in TB:
if Num[0] not in Dict:
ToT += 1
Dict[Num[0]] = ToT
self.INT_MAX = ToT + 10
self.TreeCount = [0 for x in range(self.INT_MAX+1)]
for Num in TB:
if Num[1] == 1:
L = buildings[Num[2]][0]
R = buildings[Num[2]][1]
H = buildings[Num[2]][2]
self.Add(Dict[R],H)
else:
L = buildings[Num[2]][1]
Temp = self.Find(Dict[L]+1)
if Temp != High_Now:
if (len(Ret)>0)and(Ret[-1][0] == L):
Ret[-1][1] = max(Ret[-1][1],Temp)
else:
Ret.append([L,Temp])
High_Now = Temp
return Ret
```