Solution for LinkList problem