add linked cycle and maxsubarray