Merge ranked results from lexical and vector search into a single deduplicated list.
Full problem description visible. Upgrade to unlock the editor, test cases, and solution.
Implement hybrid_merge(lexical, vector) that merges two ranked lists of results.
- Each list contains dicts with keys "id", "text", and "score".
- Deduplicate by "id" — if the same id appears in both lists, keep the entry with a higher score.
- Normalize scores to a 0–1 range within each list before merging (min-max scaling).
- After merging, sort by normalized score descending.
- Return the top 10 results.
- If a list is empty, merge only the non-empty list.
₹999/monthLimited period launch pricing.
Get the full problem statement, test cases, interactive editor, solution explanation, and visual diagram.
def hybrid_merge(lexical, vector):
"""Merge two ranked result lists, deduplicate by id, and return top 10 by normalized score."""Normalize and merge
Already have Pro access? Sign in