Compute Range Sum Quickly
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's understanding of range-sum queries, array preprocessing techniques and algorithmic complexity for answering multiple queries, assessing competency in algorithmic problem-solving and data-structure selection.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([2,4,1,7,3], 1, 3)
Expected Output: 12
Explanation: Prompt example.
Input: ([-1,5,-2], 0, 2)
Expected Output: 2
Explanation: Includes negatives.
Input: ([10], 0, 0)
Expected Output: 10
Explanation: Single element.
Hints
- Pick a representation that makes the requested operation direct.
- Handle empty inputs and boundary cases first.