SafetyCulture interview question

Coding question based on manipulating maps / arrays to certain criteria