UC Merced interview question

how to handle the classes