I know you know how much I love list-comprehensions, but you could reduce the number of times you iterate over this list by computing the max length as you extract the pairs by doing a `lists:foldr`.