Microsoft Interview Question

Print a zigzag graph where each level will be inverted