Filter and Rank Eligible Pros for a Service Request

Last updated: November 29, 2026

Quick Overview

Given a list of pros (categories, service zip codes, rating, review count, paused flag) and a customer request (category, zip), return the top k eligible pro ids ordered by rating, then review count, then id.

Thumbtack
Coding & Algorithms
Software Engineer
Thumbtack
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of pros (categories, service zip codes, rating, review count, paused flag) and a customer request (category, zip), return the top k eligible pro ids ordered by rating, then review count, then id.

A warm-up in the style of a Thumbtack phone screen: it mirrors the candidate-selection step that runs before any ML ranking, where a request is matched against pro job preferences. The interviewer checks clean filtering, a correct multi-key sort and attention to eligibility rules like paused pros.

What the Interviewer Expects
  • Restates eligibility rules (category, service area, not paused) before coding
  • Uses a single tuple sort key with correct directions for each field
  • Handles ties deterministically
  • Discusses how this scales when pros number in the millions (index by category and zip)
  • Writes small test cases including empty results
Key Topics to Cover
Filtering
Multi-key sorting
Inverted index
Top-k selection
Marketplace eligibility
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you index pros so this lookup is fast for millions of pros?
  • Pros define service areas as a radius instead of zip lists. What changes?
  • How would you return the top k without sorting every eligible pro?
  • How would you blend in a pro's remaining weekly budget?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: pros, each with id, categories (set), zips (set), rating, review_count, optional paused; a request with category and zip; and k. A pro is eligible if not paused, serves th...

High-Level Design

This is the candidate-selection step of matching: cheap hard filters first, ordering second. In production you would not scan every pro; you would keep an inverted index keyed by (category, zip) tha...


Submit Your Answer
Markdown supported

Related Questions