finished 3 easy tasks for bfs and dp