Find max  cycle length in given ranges