Binary Tree Level Order Traversal
the difference between and and offer in Queue?
From theCollection)interface:
If a collection refuses to
adda particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.
From theQueue)interface
When using queues that may impose insertion restrictions (for example capacity bounds), method
offeris generally preferable to methodCollection.add(E), which can fail to insert an element only by throwing an exception.
这道题也可以用dfs做就是比较麻烦, 且时间复杂度较高
