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
Coding & Algorithms
Software Engineer
Perplexity
September 4, 2025
Software Engineer
Coding Round
Coding & Algorithms
Medium

5

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
Weighted scoring
Stable sorting
Feature engineering
Tie-breaking
Score normalization
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 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 Problems
Sample 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,...


Submit Your Answer
Markdown supported

Related Questions