GTM Buddy interview question

code the algorithm of k means clustering