Given an array of size $n$, we have to find the maximum number of multiples of $A[i]$ in the array, where the indexes of the multiples should be less than $i$.
For example, given the array
36 40 16 24 27 12 9 4
weWe see that element 4 has the highest number of multiples (5) as per the given conditions, so the answer is 5.
My approach: I used brute force to solve this. I used nested loops to solve this. The first loop from the last element and the second loop from the first element to the second to last element.
Can you help me improve the running time?