Solved ZigZag Problem