class Solution(object):
def findRightInterval(self, intervals):
"""
:type intervals: List[List[int]]
:rtype: List[int]
"""
invs = sorted((x.start, i) for i, x in enumerate(intervals))
ans = []
for x in intervals:
idx = bisect.bisect_right( invs, (x.end,) )
ans.append(invs[idx][1] if idx < len(intervals) else -1)
return ans