CMR Surgical Interview Question

Write a piece of code.