Modify array by replacing elements with the nearest power of its previous or next element
Given a circular array arr[] consisting of N positive integers, the task is to modify the array by replacing each array element with the nearest power of its previous or next array element. Examples: Input: arr[] = {2, 3, 4, 1, 2}Output: {2, 4, 3, 1, 2}Explanation:For arr[0](= 2): The previous and t