solved a linked-list reverse problem