X Interview Question

Star method to be applied