104. Traverse DOM level by level

JavaScriptAlgorithmDOM
Is this helpful ?

medium  - accepted / - tried

Given a DOM tree, flatten it into an one dimensional array, in the order of layer by layer, like below.

Let's try to solve this problem within 10 minutes.

Discuss(65)