[LeetCode打卡] BFS #958 Check Completeness of a Binary Tree

难度:

考察点:BFS

解法:BFS把每一个结点的两个子结点放入队列中,当队列第一个值为None的时候循环结束。如果队列中还有非None的值,结果为非complete tree。反之,为complete tree。


参考:

https://leetcode.com/problems/check-completeness-of-a-binary-tree/discuss/860671/python-queue-appending-check-final-array-for-non-Nones

你可能感兴趣的:([LeetCode打卡] BFS #958 Check Completeness of a Binary Tree)