Tenable Interview Question

What I wrote in Google to solve a problem in the task