Achievers Interview Question

write code for a functionality to automate