Add solution to problem 336 from UVa using the BFS algorithm.