← Bobyard Interview Insights

Bobyard·Software Engineer·Technical Phone Screen·Senior

SeniorPrefer not to say
Jun 2026Remote

Summary

Live coding round at bobyard for a full-stack role, about 45 minutes, no talking through design or architecture, just build it. The problem was frontend-focused with a tricky bonus filter requirement that I didn't fully see coming.

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 parentId part is straightforward if you've done tree rendering before, basically build a map of id to children and recurse.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data shape and edge cases (orphans, cycles, missing parents), then propose an O(n) two-pass approach: build a map from id to node and link children to parents. Finally, outline a recursive React component that renders the tree with proper keys and indentation, and mention memoization for performance.

Pro tip: Mention that you'd handle orphaned comments (parentId not found) by treating them as roots or logging them, and that you'd guard against cycles to avoid infinite loops—this shows production-awareness beyond the happy path.

1. Clarify requirements and edge cases

Ask about the data shape (flat array with id/parentId), expected depth, and how to handle orphans, cycles, and deleted parents. Confirm rendering expectations (indentation, collapse, etc.).

2. Design the data transformation

Propose building a hash map of id → node and a second pass to attach children to parents, achieving O(n) time. Identify root nodes (parentId null or missing) and handle orphans explicitly.

3. Implement the recursive rendering component

Create a Comment component that renders itself and maps over its children recursively. Use stable keys (comment id) and apply indentation via CSS or nested lists.

4. Optimize and handle edge cases

Memoize the tree transformation and consider React.memo for comment nodes to avoid unnecessary re-renders. Add cycle detection or depth limits to prevent infinite recursion.

5. Test and validate

Walk through examples: empty array, single root, multiple roots, deep nesting, orphaned comments, and cyclic references. Ensure the UI renders correctly and efficiently.

Key Points to Mention

  • Two-pass O(n) algorithm using a map for id → node and linking children
  • Handling edge cases: orphans, cycles, missing parents, and multiple roots
  • Recursive React component with stable keys and indentation
  • Performance considerations: memoization, React.memo, and avoiding deep recursion limits
  • Mock data setup: flat array with id, parentId, content, and optional metadata
  • Accessibility and UX: collapsible threads, ARIA roles for nested comments

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, while non-matching siblings and their subtrees are hidden.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where it got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the filter semantics: a comment is shown if it matches the filter OR any of its descendants match. Then design a recursive function that returns whether a subtree contains a match, and use that to decide visibility. Discuss trade-offs between recursive and iterative approaches, and mention performance considerations for large comment trees.

Pro tip: Mention that you would memoize or precompute match status to avoid repeated traversals, and consider using a virtualized list for rendering to handle deep or large comment threads efficiently.

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. Define the visibility rule

A comment is visible if its text matches the filter OR any of its descendants match. Non-matching siblings and their subtrees are hidden.

3. Design the algorithm

Use a recursive post-order traversal: for each node, recursively process children, then determine if the node itself matches or if any child is visible. Return a boolean indicating if the subtree contains a match.

4. Implement efficiently

Avoid re-traversing the tree on each filter change by precomputing match status or using memoization. Consider iterative approach with a stack to avoid recursion depth limits.

5. Discuss trade-offs and optimizations

Compare time complexity (O(n) per filter) and space complexity (O(h) for recursion). Suggest debouncing filter input and virtualizing the rendered list for performance.

Key Points to Mention

  • Recursive post-order traversal to propagate visibility upward
  • Time complexity O(n) where n is number of comments
  • Space complexity O(h) for recursion stack, or O(n) for iterative with explicit stack
  • Handling of empty filter (show all) and case-insensitive matching
  • Memoization or precomputation to avoid repeated traversals on filter change
  • Virtualization or lazy rendering for large comment trees

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