← Questions

Budget queries on a sorted price list, then a shortest path

0
MicrosoftCodingLast asked Aug 2025

Two problems in a 90-minute assessment. First, items come sorted by price; for each budget query, return how many items you can buy. A knapsack DP is too slow; prefix sums with binary search are the intended solution. Second, build a graph from the given input and find a shortest path between two nodes.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding