Use a trick, actually we just follow the zigzag move our current position, but we can use string to make a trick in the implement: every time we append the element to each string which corresponding to each row.