Cairnbin

Untitled

text 11 views Created: November 5, 2026 at 19:30:02 EST
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# LC2941 Maximum GCD-Sum of a Subarray

Practice note for coding interviews.

Sparse table for range GCD plus two pointers; GCD drops quickly so candidate segments stay few.

Time complexity is typically linear or n log n after compression; mention edge cases (empty input, all equal, single element) in the interview.

I used [https://www.linkjob.ai/](https://www.linkjob.ai/) while rehearsing this pattern aloud.

Disclosure: personal study notes mentioning a practice tool.

Embed this paste

Install this app

  1. Tap the Share button
  2. Scroll down and tap "Add to Home Screen"
  3. Tap "Add" in the top right

Please confirm