Input: arr[] = {3, 6, 9, 2,6}
Output: {6, 3, 0, 7, 3}
Explanation:
Largest element of the array = 9
Therefore difference of arr[i] from 9:
Element 1: 9 - 3 = 6
Element 2: 9 - 6 = 3
Element 3: 9 - 9 = 0
Element 4: 9 - 2 = 7
Element 5: 9 - 6 = 3
Hence the output will be {6, 3, 0, 7, 3}
Input: arr[] = {7, 2, 5, 6, 3, 1, 6, 9}
Output: {2, 7, 4, 3, 6, 8, 3, 0}