All right boys, it's time for an interview programming question to get your brain fired up again:
You are given a grid of numbers, and you have to write a function that takes as input a two dimensional array and returns a single dimensional array that is all the diagonals in zig zag order.
In this example the input is [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]. And your code should produce the output [1, 2, 6, 11, 7, 3, 4, 8, 12, 16, 17, 13, 9, 5, 10, 14, 18, 19, 15, 20]. Use any programming language you like.