← ALL NOTES
Array

3312. Sorted GCD Pair Queries

Given an array nums of n numbers and an array of queries. For all pairs (i < j) compute gcd(nums[i], nums[j]); collect all these values into an array gcdPairs and sort ascending. For each query…

Loading…