Delhivery Hiring Question

Q: Given an array we have to calculate floor(arr[i]/ arr[j]) for all pairs of {0 <= (i, j) < n}. I only able to solve it using Brute Force…tried CHONQ approach to try to find a pattern…but it still needs more optimization. Any Suggestion on how to solve this problem?

Constrains: Size of Array (n) <= 10^5

2 Likes