for i in range(min(sequenceDict), max(sequenceDict)):
    if i not in sequenceDict:
        sequenceDict[i] = []
sortedItems = map(lambda x: x[1], sorted(list(sequenceDict.items()), key=lambda x:
    x[0]))
globalHotItems = {}
currentHotItems = {}
for i in range(len(sortedItems)):
    updatedHotItems = {}
for item in sortedItems[i]:
    if item - 1 in currentHotItems:
        updatedHotItems[item] = currentHotItems[item - 1] + 1
else:
    updatedHotItems[item] = 1
deadSet = set(currentHotItems.keys()) - set(list(updatedHotItems.keys()) + [(key -
    1) for key in list(updatedHotItems.keys())])
for item in deadSet:
    globalHotItems[item - currentHotItems[item] + 1, i - currentHotItems[item]
        ] = currentHotItems[item]
currentHotItems = updatedHotItems
print(sorted(list(globalHotItems.items()), key=lambda x: x[1])[-1])
Most efficient way to find longest incrementing subsequence in a list of lists