Microsoft interview question

write function that calculate x^y