This question was asked in InterviewBit Academy Enterance Test on 16 Feb.
Problem Description :
Given an integer array A of size N. You can delete at most B elements from the array such that the GCD(Greatest commmon divisor) of the remaining array is maximum. Find the maximum GCD of the remaining array.
Constraints :
1 \leq N \leq 10^{4}
1 \leq A[i] \leq 5 \times 10^{4}
0 \leq B < N
Please suggest the approach of this problem.