DEV Community

Discussion on: LeetCode in Ruby: 102. Binary Tree Level Order Traversal

Collapse
 
rnrnshn profile image
Olimpio

Can you explain me the following code? Mainly the <<... #RubyNewbie here

result << [] if result.length == level
Collapse
 
algobot76 profile image
Kaitian Xie

It means that just before we begin to store the values of the next level, we add an empty array that will be used to store the values.