← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Meta Data Engineer coding screen, one question the whole time. Pretty algorithmic for a DE role but not unreasonable once you see what they're actually asking for.

Questions Asked (1)

Q1

Given a list of books where each book has a category and a point value, return the maximum total points a student can earn by selecting at most 3 books, with the constraint that no two selected books can share the same category.

Algorithms & Data Structures
Author's notes

My first instinct was to reach for combinations and just brute force it, which would've been fine for small inputs but they flagged upfront that the list could be large.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints and edge cases, then propose an efficient algorithm. For each category, keep only the top 3 book values, then use a greedy or dynamic programming approach to select up to 3 books from distinct categories that maximize total points.

Pro tip: Mention that since we can select at most 3 books, we can optimize by reducing each category to its top 3 values, and then use a priority queue or sorting to combine them efficiently. This shows awareness of practical optimization.

1. Clarify the problem

Ask questions to confirm constraints: Can we select fewer than 3 books? Are point values positive? What if there are fewer than 3 categories? This ensures you understand the requirements.

2. Outline a brute-force approach

Discuss a naive solution: generate all combinations of up to 3 books from distinct categories and compute the maximum. This establishes a baseline and shows you can think simply.

3. Optimize using top values per category

Observe that for each category, only the top 3 book values matter because we can pick at most 3 books total. Extract these top values per category.

4. Design an efficient selection algorithm

Use a greedy approach: sort all candidate books by value descending, then iterate and pick books from distinct categories until 3 are chosen. Alternatively, use dynamic programming over categories with state (number of books chosen, total points).

5. Analyze complexity and test edge cases

State time and space complexity (e.g., O(N log N) for sorting). Test with cases like fewer than 3 categories, negative values, or ties.

Key Points to Mention

  • Clarify constraints: at most 3 books, distinct categories, point values can be positive/negative.
  • Reduce each category to its top 3 values to limit candidates.
  • Use a greedy approach: sort all candidates by value and pick from distinct categories.
  • Alternatively, use dynamic programming with state (category index, books chosen, total points).
  • Time complexity: O(N log N) due to sorting, or O(N) with heap if only top 3 per category.
  • Handle edge cases: fewer than 3 categories, empty list, negative values (skip if not beneficial).

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