Alternate way shows error


#1

Why can’t we directly modify the given array instead of copying it to new array in every iteration. Can someone please explain?


#2

if you modify the given array in the current iteration then you will be losing some of the values required to compute the max element using previous values. Please look at your recursive formula to calculate the max value to get an idea of what I’m referring to or post it here and we can discuss further.


#3

Yes you’re right…we’ll be losing values if we modify it each iteration.I got it…Thank you so much!