Leetcode Constraints Time Complexity Of Bfs Search In Python