IBM interview question

Vertex related issues