Find maximum cable length by cutting
Company: Bloomberg
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's proficiency in algorithm design, particularly applying binary search over a monotonic answer space and managing integer versus floating-point precision when maximizing piece length.
Constraints
- Inputs are provided as Python literals matching the function signature.
- Return a deterministic exact-match result.
Examples
Input: ([802, 743, 457, 539], 11)
Expected Output: 200
Explanation: Classic cable cutting.
Input: ([5, 5], 20)
Expected Output: 0
Explanation: Impossible target.
Input: ([], 1)
Expected Output: 0
Explanation: No cables.
Hints
- Choose a representation that makes the core operation simple.
- Handle empty and boundary inputs before the main algorithm.