Traverse DOM tree and flatten it into a one-dimensional array in breadth-first order.
Asked in frontend interviews at Meta and LinkedIn