give array arr replace element array great element element right replace element 1After return array Example 1input arr 17185461output 1866611explanation index 0 great element right index 0 index 1 18 index 1 great element right index 1 index 4 6 index 2 great element right index 2 index 4 6 index 3 great element right index 3 index 4 6 index 4 great element right index 4 index 5 1 index 5 element right index 5 1example 2input arr 400output 1explanation there element right index 0 Constraints1 arrlength 1041 arri 105