Build a Ranking and Scoring Workflow
Last updated: September 4, 2025
Quick Overview
Given documents with multiple feature scores, implement a weighted scoring function, sort results, and handle ties deterministically.
Perplexity
September 4, 20255
7
1,544 solved
Given documents with multiple feature scores, implement a weighted scoring function, sort results, and handle ties deterministically.
Practical search engineering problem directly relevant to Perplexity's document ranking pipeline.
What the Interviewer Expects
- Implement configurable weighted scoring
- Sort results stably with deterministic tie-breaking
- Handle missing feature scores gracefully
- Support dynamic weight adjustment
- Discuss normalization strategies for heterogeneous features
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you add feature normalization?
- What if some features are on different scales?
- How would you A/B test different weight configurations?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Implementation
```python def score_and_rank(documents, weights, default_score=0.0): scored = [] for doc in documents: total = sum( weight...
Normalization
Features on different scales (BM25 score: 0-25, freshness: 0-1) need normalization. Options: min-max normalization per feature, z-score normalization,...