Count Nodes of Linked List
Problem Statement
Given a singly linked list. The task is to find the length of the linked list, where length is defined as the number of nodes in the linked list
Example 1
Example 2
Task
Your task is to complete the given function getCount(), which takes a head reference as an argument and should return the length of the linked list.
Expected Time Complexity : O(N)
Expected Auxiliary Space : O(1)
Constraints :
1 <= N <= 105
1 <= value <= 103
0 Comments