Visit Level by Level

Talk it through out loud with your AI coach.

The problem

  • medium
  • Pro

Given a binary tree, return its values grouped by level: the root's level, then the next level from left to right, and so on. Explain your approach and its cost.