Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2941. Maximum GCD-Sum of a Subarray
Given an array of positive integers, find a contiguous subarray that maximizes the total GCD-score defined by summing gcd(a[i], a[j]) over all unordered pairs of elements within the subarray. The challenge is to avoid O(n^2) pair checks by using number‑theory optimizations (grouping by divisors, multiplicity counting, prefix techniques) to compute contributions efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.