Aptean Interview Question

Coding question on Triangle Pyramid