Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Create Intervals solution in Speedy category for Create Intervals by JimmyCarlos
def create_intervals(A):
A = sorted(list(A))
B = []
while len(A) > 0:
startI = 0
endI = 0
while endI < len(A) - 1 and A[endI+1] == A[startI] + endI + 1:
endI += 1
B += [(A[startI],A[endI])]
A = A[endI+1:]
return B
Aug. 6, 2018