Attempt of solving LeadCycSeq problem