Max Subarray GCD - Editorial

I had tried a segment tree solution , and my brute didnt check for your “if” condition. Thanks for notifying though!

Thanks a lot for the code and the explanation. I understood it now.