DEV Community

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

Collapse
olimpioadolfo 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 Author

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.