prog 2

The array is first sorted. And then the maximum power returned.