PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Microsoft

Solve binary-search knapsack & graph shortest path

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to apply algorithmic optimization by using binary search instead of dynamic programming for a knapsack-style selection problem and to construct and compute shortest paths on a weighted graph from custom input.

  • Medium
  • Microsoft
  • Coding & Algorithms
  • Software Engineer

Solve binary-search knapsack & graph shortest path

Company: Microsoft

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Take-home Project

##### Question Given a sorted list of items, design an efficient solution (using binary search) to achieve the target objective instead of a dynamic-programming knapsack approach. Given a weighted graph provided in a custom input format, build the graph and compute the shortest path between two nodes.

Quick Answer: This question evaluates a candidate's ability to apply algorithmic optimization by using binary search instead of dynamic programming for a knapsack-style selection problem and to construct and compute shortest paths on a weighted graph from custom input.

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
Aug 4, 2025, 10:55 AM
Software Engineer
Take-home Project
Coding & Algorithms
3
0
Question

Given a sorted list of items, design an efficient solution (using binary search) to achieve the target objective instead of a dynamic-programming knapsack approach. Given a weighted graph provided in a custom input format, build the graph and compute the shortest path between two nodes.

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.