PTC Interview Question

I was asked to implement "swap" function