Leetcode Breadth First Search Algorithm With Python