Solved hw1 with linkedlist