PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Microsoft

Return Top K Relevant Apps

Last updated: Apr 19, 2026

Quick Overview

This question evaluates algorithmic problem-solving around aggregation and ranking, testing skills in computing aggregated relevance scores, deterministic tie-breaking, and efficient selection of top-k items.

  • medium
  • Microsoft
  • Coding & Algorithms
  • Software Engineer

Return Top K Relevant Apps

Company: Microsoft

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given a mapping from application name to keyword relevance scores, for example: ```json { "github": {"diff": 0.3, "code review": 0.8}, "jira": {"ticket": 0.7, "workflow": 0.4} } ``` Define an application's overall relevance as the sum of all its keyword scores. Given this structure and an integer `k`, return the names of the `k` most relevant applications sorted by descending relevance. If two applications have the same total relevance, break ties by application name in ascending lexicographic order. Discuss an efficient approach and its time complexity.

Quick Answer: This question evaluates algorithmic problem-solving around aggregation and ranking, testing skills in computing aggregated relevance scores, deterministic tie-breaking, and efficient selection of top-k items.

Related Interview Questions

  • Return Top K Open Businesses - Microsoft (hard)
  • Implement Memory Allocation and In-Memory Records - Microsoft (medium)
  • Implement K-Means and Detect Divisible Subarrays - Microsoft (medium)
  • Sort Three Categories In Place - Microsoft (medium)
  • Retain Top K Elements - Microsoft (medium)
Microsoft logo
Microsoft
Mar 16, 2026, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
10
0
Loading...

You are given a mapping from application name to keyword relevance scores, for example:

{
  "github": {"diff": 0.3, "code review": 0.8},
  "jira": {"ticket": 0.7, "workflow": 0.4}
}

Define an application's overall relevance as the sum of all its keyword scores. Given this structure and an integer k, return the names of the k most relevant applications sorted by descending relevance. If two applications have the same total relevance, break ties by application name in ascending lexicographic order.

Discuss an efficient approach and its time complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Microsoft•More Software Engineer•Microsoft Software Engineer•Microsoft Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.