You have to observe the pattern carefully. Actually this question is a lot easier than it seems. Only the first and last row has n elements, rest have only one element. Remember, questions can be new, but if they are present in GATE, they are very much solvable within the time limit if you catch the point of the question, and practice alot.