Write flatten(grid) that takes a list of lists and returns a single new list containing all the items of the first inner list, then the second, and so on.
Examples
Input: grid = [[1, 2], [3], [4, 5, 6]]
Output: [1, 2, 3, 4, 5, 6]
Input: grid = [[], [9]]
Output: [9]
Constraints
0 <= len(grid) <= 500- each inner list has at most
100items
Goals
- Combine several inner lists into one flat list
- Keep the left-to-right, top-to-bottom order