Solution for ZigZag Conversion