List the K Cheapest Pairings of Azure Compute and Storage SKUs

Last updated: November 29, 2026

Quick Overview

Given sorted monthly prices for compute SKUs and for storage SKUs, return the k compute and storage pairings with the lowest combined price, cheapest first.

Microsoft
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given sorted monthly prices for compute SKUs and for storage SKUs, return the k compute and storage pairings with the lowest combined price, cheapest first.

A k-way merge with a heap, framed as an Azure pricing calculator feature. The interviewer checks that the candidate does not build all m x n pairs, and that the heap starts with one frontier entry per row.

What the Interviewer Expects
  • Avoid materializing all m x n sums
  • Seed the heap with (compute[i], storage[0]) for the first k rows
  • After popping (i, j), push (i, j + 1)
  • Prove that no pair is missed or repeated
  • State O(k log k) time
Key Topics to Cover
heaps
k-way merge
top-k
Azure pricing scenario
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
  • What if the input lists are not sorted?
  • Return the k-th cheapest total only, using binary search on the answer.
  • Extend to three categories: compute, storage, and networking.
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
  • compute and storage are sorted ascending (duplicates allowed).
  • Output: up to k pairs (c, s) in increasing c + s....
High-Level Design

Think of a grid where cell (i, j) holds compute[i] + storage[j]. Rows and columns are sorted, so each row is a sorted list and the problem becomes merging m sorted rows and stopping after k items. Sta...


Submit Your Answer
Markdown supported