Teradata interview question

Whiteboard: Calculate string permutation