working on reversed linked list problem and rectangle intersection problem