added solutions for detecting list cycle