Count smaller primes on the right of each array element
Given an array A[] of size N, the task for each array element is to count the array elements on their right that are smaller than it and are prime. Examples: Input: N = 10, A[] = {5, 5, 17, 9, 12, 15, 11, 7, 39, 3} Output: 2 1 3 2 3 3 2 1 1 0 Explanation: For i = 1, elements at j = [2, 10] are valid