← Coinbase Interview Insights

Coinbase·Frontend Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Coinbase frontend round focused almost entirely on one meaty React/state-management problem. It felt less like a coding screen and more like a design discussion with code attached, which I wasn't fully prepared for.

Questions Asked (3)

Q1

You're building a blog app that pulls posts and users from separate APIs. Each post has a like count and a most-recent-like timestamp. How do you sort posts by likes descending, breaking ties by recency, and keep that order correct after adds and deletes?

Technical Trade-offsSystem Design
Author's notes

I jumped straight into useMemo and felt pretty good about it, but they pushed back asking whether I'd just sort on every render instead.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a data structure that maintains sorted order efficiently. Discuss trade-offs between sorting on read vs. maintaining order on write, and explain how to handle updates and deletions while keeping the sort stable.

Pro tip: Mention that you'd use a balanced BST or a skip list to achieve O(log n) insertions and deletions while keeping the list sorted, and highlight that this avoids re-sorting the entire list on every change—a common pitfall.

1. Clarify requirements and constraints

Ask about expected data volume, frequency of updates, and whether the sorting needs to be client-side or server-side. Confirm that ties are broken by most-recent-like timestamp descending.

2. Choose a data structure

Propose a balanced binary search tree (e.g., AVL or Red-Black) or a skip list where the key is (likeCount, timestamp) in descending order. This allows O(log n) insertions, deletions, and in-order traversal.

3. Handle updates and deletions

For a like count change, remove the old node and insert a new one with updated key. For deletion, remove the node. Both operations maintain sorted order without full re-sort.

4. Consider API integration and caching

Fetch posts and users from separate APIs, merge data, and maintain the sorted structure in a client-side store (e.g., Redux, MobX). Use caching to avoid refetching on every update.

5. Discuss trade-offs and alternatives

Compare with simpler approaches like sorting on read (O(n log n) per render) or using a priority queue (only efficient for top-k). Explain why the chosen structure is optimal for frequent updates.

Key Points to Mention

  • Use a balanced BST or skip list with composite key (likeCount, timestamp) for O(log n) operations.
  • Avoid re-sorting the entire list on each update; maintain order incrementally.
  • Handle ties by timestamp descending, ensuring stable and correct ordering.
  • Consider client-side state management and caching to minimize API calls.
  • Discuss trade-offs: sorting on read vs. maintaining sorted order on write.
  • Mention edge cases: concurrent updates, optimistic UI updates, and eventual consistency.

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

Q2

For posts authored by the current logged-in user, how would you render a delete button that removes the post from local state while maintaining correct sort order?

API & IntegrationsTechnical Trade-offs
Author's notes

This part went okay.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data flow: posts are stored in local state, likely an array sorted by a specific criterion (e.g., timestamp). Then describe a delete handler that filters out the post by ID and updates state immutably, ensuring the sort order is preserved because the remaining items retain their relative order. Finally, discuss UI considerations like conditional rendering based on ownership and optimistic updates with error handling.

Pro tip: Mention that if the list is sorted by a mutable field (e.g., 'updatedAt'), deleting an item won't affect the sort order of others, but if you're using an index-based key, you should switch to a stable unique ID to avoid React reconciliation issues. Also, consider using a functional state update to avoid stale closures.

1. Clarify data structure and sorting

Confirm that posts are stored in an array in local state and sorted by a stable criterion (e.g., creation date). Identify the unique identifier for each post.

2. Implement delete handler

Create a function that takes a post ID, filters the array to exclude that post, and updates state immutably (e.g., using setState with a new array).

3. Ensure sort order is maintained

Explain that filtering preserves the relative order of remaining items, so the sort order remains correct. If needed, re-sort after deletion, but it's usually unnecessary.

4. Render delete button conditionally

Only render the delete button for posts authored by the current user, using a comparison of user IDs. Attach the delete handler to the button's onClick event.

5. Handle side effects and edge cases

Discuss optimistic UI updates, error handling if deletion fails (e.g., revert state), and accessibility (e.g., aria-label).

Key Points to Mention

  • Immutable state updates using filter or spread operator
  • Using unique IDs as keys instead of array indices
  • Conditional rendering based on post.authorId === currentUser.id
  • Preserving sort order by not mutating the original array
  • Optimistic updates and rollback on error
  • Accessibility considerations for the delete button

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

Q3

How do you handle keying in a dynamically sorted list to avoid rendering issues when items move positions?

Technical Trade-offs
Author's notes

Used post ID as the key, explained why index keys break when order changes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that stable, unique keys are essential to preserve component identity when list items reorder. Then discuss how React's reconciliation uses keys to match elements, and the pitfalls of using array indices or unstable keys. Finally, mention strategies for dynamic sorting, such as deriving keys from item IDs and avoiding key changes during reordering.

Pro tip: Emphasize that keys should be stable, predictable, and unique—never based on array index or random values. Also, consider using a library like react-flip-toolkit to animate reordering smoothly, which can prevent visual glitches.

1. Define the problem

Explain that when a list is dynamically sorted, items move positions, and without stable keys, React may reuse DOM nodes incorrectly, causing state loss or rendering issues.

2. Explain key principles

Describe how React uses keys to identify elements, and why keys must be unique and stable across renders. Mention that index-based keys fail when order changes.

3. Provide solution

Recommend using a unique identifier from the data (e.g., item.id) as the key. If no ID exists, generate a stable ID when the item is created and persist it.

4. Address dynamic sorting

Explain that when sorting, the keys remain the same, so React moves the DOM nodes instead of recreating them, preserving state and avoiding flicker.

5. Mention advanced considerations

Discuss performance implications, such as avoiding unnecessary re-renders, and using techniques like memoization or virtualization for large lists.

Key Points to Mention

  • React reconciliation and the role of keys
  • Why array indices are problematic as keys
  • Using stable unique identifiers (e.g., database IDs)
  • Preserving component state during reordering
  • Performance optimizations for large lists
  • Potential use of animation libraries for smooth transitions

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