IBM interview question

How does the KNN algorithm work?