Leaderboard
Showing:
Learning Structs
Easy Accuracy: 80.18% Submissions: 8204 Points: 2

Structures are very useful when we want to create Linked Lists and Trees. Here we will learn to create a Linked List struct.

Input Format:
The first line of testcase contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains N denoting the number of nodes of the linked list. The second line contains the elements of the linked list.

Output Format:
For each testcase, in a new line, print the length of the linked list.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided struct. All the other functions of the linked-list are already implemented.

Constraints:
1 <= T <= 100
1 <= N <= 100

Examples:
Input:

1
5
1 2 3 4 5
Output:
5

Explanation:
Testcase1:

1->2->3->4->5->NULL is the linked list formed. The length is 5

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Learning Structs

Output Window