**Task:- **Given a matrix of ‘m’ rows and ’n’ columns, each describing the height of the bar at that block, find the surface area of the resulting 3D figure.

For better understanding see the example and figure in the question link.

**Approach:- **For getting the surface area of the 3D…