Search
⌘K

Leetcode 3574. Maximize Subarray GCD Score

Given an array nums and up to k operations that can double distinct elements (each at most once), choose a contiguous subarray and up to k elements to double to maximize the score defined as (subarray length × GCD of its elements). With n ≤ 1500 and nums up to 1e9, the challenge is to efficiently explore subarray GCDs and the combinatorial impact of up to k single-element doublings.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.