Vaultedge Interview Question

A coding question was asked to solve