
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort <code>hBars</code> and <code>vBars</code> and consider them separately.
Compute the longest sequence of consecutive integer values in each array, denoted as <code>[hx, hy]</code> and <code>[vx, vy]</code>, respectively.
The maximum square length we can get is <code>min(hy - hx + 2, vy - vx + 2)</code>.
Square the maximum square length to get the area.