Question DSA-ARR-0010
MediumUsing a prefix-sum array, how fast can you answer 'sum of elements from index l to r'?
- A.
O(1) per query after O(n) preprocessing
- B.
O(n²) per query
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Arrays question
Using a prefix-sum array, how fast can you answer 'sum of elements from index l to r'?
O(1) per query after O(n) preprocessing
O(n²) per query
Sign up free to see the answer and a step-by-step explanation.
O(log n) per query
O(n) per query