Leetcode Constraints Time Complexity Of Bfs Search Python