← bobyard Interview Insights

bobyard·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026Remote

Summary

Live coding round at Bobyard for a full-stack role, about 45 minutes, no discussion time built in. The task was purely implementation focused and had a bonus filter feature that I suspect most people don't finish.

Questions Asked (2)

Q1

Given comment data that includes a parentId field, render the comments as a nested threaded tree in the frontend using mock data (no backend changes needed).

Algorithms & Data StructuresSystem Design
Author's notes

The core part wasn't too bad once I stopped overthinking the recursion.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data shape and edge cases (orphaned comments, missing parentId, cycles). Then describe a two-pass approach: build a map from id to comment and attach children to parents, producing a tree in O(n) time. Finally, explain how you'd render it recursively in the frontend with proper indentation and keys.

Pro tip: Mention that you'd handle orphaned comments (parentId not found) by treating them as roots or logging them, and that you'd avoid mutating the original data by creating shallow copies. This shows you think about real-world data quality and immutability.

1. Clarify requirements and data shape

Ask about the comment object structure (id, parentId, content, etc.), whether parentId can be null/undefined for root comments, and if there are any constraints like max depth or sorting order.

2. Design the tree-building algorithm

Explain a two-pass O(n) approach: first create a map of id to comment (with an empty children array), then iterate again to link each comment to its parent. Handle orphans by treating them as roots or skipping them.

3. Implement the recursive rendering component

Describe a recursive React component (or equivalent) that takes a comment node and renders its content, then maps over its children to render nested Comment components with increased indentation.

4. Address edge cases and performance

Discuss handling cycles (e.g., using a visited set), deep nesting (potential stack overflow, consider iterative rendering), and memoization to avoid unnecessary re-renders.

5. Test with mock data

Mention creating mock data covering typical cases, orphans, and deep nesting, and verifying the rendered output matches expectations.

Key Points to Mention

  • Two-pass O(n) algorithm using a hash map for id-to-comment lookup
  • Handling orphaned comments (parentId not found) by treating them as roots or logging
  • Avoiding mutation of original data by creating shallow copies or using immutable updates
  • Recursive component rendering with proper keys and indentation
  • Edge cases: cycles, deep nesting, missing parentId, and performance considerations
  • Using mock data to simulate backend response and test the rendering

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Bonus: add a filter to the nested comment view so that only comments matching the filter text and their descendants are shown, hiding non-matching siblings and their subtrees.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where it got tricky.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the requirements first: the filter should show comments that match the text and all their descendants, while hiding non-matching siblings and their subtrees. Then propose a recursive tree traversal that returns a filtered subtree, and discuss trade-offs between mutating the tree and creating a new filtered structure.

Pro tip: Mention that you would preserve the original data and compute the filtered view on the fly to avoid side effects, and consider memoization or virtualization for performance with large comment trees.

1. Clarify requirements and edge cases

Ask whether the filter is case-sensitive, whether it applies to comment text only or also author names, and how to handle empty filter (show all).

2. Design the recursive algorithm

Write a function that takes a comment node and returns a filtered copy: include the node if it matches or if any descendant matches; otherwise exclude it and its subtree.

3. Implement efficiently

Traverse the tree once, building a new tree of matching nodes and their ancestors. Use a post-order traversal to propagate matches upward.

4. Discuss trade-offs

Compare in-place mutation vs. creating a new tree, and consider performance implications for large trees (e.g., memoization, lazy evaluation).

5. Test and validate

Walk through examples: filter matches a leaf, a parent, multiple branches; ensure hidden siblings are removed and descendants of matches are kept.

Key Points to Mention

  • Recursive tree traversal with post-order processing
  • Preserving descendants of matching comments
  • Hiding non-matching siblings and their entire subtrees
  • Immutability vs. mutation trade-offs
  • Performance considerations for large comment trees
  • Edge cases: empty filter, no matches, root matches

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.