Question · Vibe coding with Claude Code course · Module 5: Reddit clone

Quiz: Two passes of buildCommentTree

Why does buildCommentTree go through the list of comments twice?

Answer options

  • To sort the comments from the newest
  • So that a reply stored on the list before its parent still lands under the parent
  • Because Map does not let you add an element in the first pass
  • To count the comments twice and compare the results

You can check the correct answer by solving this task in the CodeWorlds game.