Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Let's assume that the width of the array is bigger than the height, otherwise, we will split in another direction.
Split the array into three parts: central column left side and right side.
Go through the central column and two neighbor columns and look for maximum.
If it's in the central column - this is our peak.
If it's on the left side, run this algorithm on subarray left_side + central_column.
If it's on the right side, run this algorithm on subarray right_side + central_column