Google interview question

How to solve bubble sort