Learning Structs
Submissions: 1907   Accuracy:

90.76%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP

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

** For More Input/Output Examples Use 'Expected Output' option **

Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.