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:
Input:
LinkedList: 1->2->3->4->5
Output: 5
Explanation: Count of nodes in the 
linked list is 5, which is its length.
Example 2:
Input:
LinkedList: 2->4->6->7->5->1->0
Output: 7
Explanation: Count of nodes in the
linked list is 7. Hence, the output
is 7.
Your 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 Auxilliary Space : O(1)
Constraints:
1 <= N <= 10^{5}
1 <= value <= 10^{3}

Difficulty: EASY
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3

'''

#Linked list class
class LinkedList:
    def __init__(self):
        self.head=None
        self.tail=None
        '''
class Solution:
    
    #Function to count nodes of a linked list.
    def getCount(self, head_node):
        #code here

Solutions:
class Solution:

	def getCount(self, head_node):
		count = 0
		temp = head_node
		while temp:
			count += 1
			temp = temp.next
		return count


class Solution:

	def getCount(self, head_node):
		cnt = 0
		a = head_node
		while a != None:
			cnt += 1
			a = a.next
		return cnt


class Solution:

	def getCount(self, head_node):
		count = 0
		temp = head_node
		while temp is not None:
			count += 1
			temp = temp.next
		return count


class Solution:

	def getCount(self, head_node):
		c = 0
		while head_node:
			head_node = head_node.next
			c += 1
		return c


class Solution:

	def getCount(self, head_node):
		temp = head_node
		if head_node == None:
			return 0
		else:
			count = 1
			while temp.next:
				count += 1
				temp = temp.next
		return count


class Solution:

	def getCount(self, head_node):
		if head_node is None:
			return 0
		i = 1
		temp = head_node
		while temp.next is not None:
			temp = temp.next
			i += 1
		return i


class Solution:

	def getCount(self, head_node):
		t = head_node
		l = 0
		while t is not None:
			l += 1
			t = t.next
		return l


class Solution:

	def getCount(self, head_node):
		count = 0
		if head_node is None:
			return count
		currentNode = head_node
		while currentNode:
			count += 1
			currentNode = currentNode.next
		return count


class Solution:

	def getCount(self, head_node):
		cur = head_node
		p = 0
		while cur != None:
			p += 1
			cur = cur.next
		return p


class LinkedList:

	def __init__(self):
		self.head = None
		self.tail = None

class Solution:

	def getCount(self, head_node):
		count = 0
		current = head_node
		while current is not None:
			count += 1
			current = current.next
		return count


class Solution:

	def getCount(self, head_node):
		i = 0
		while head_node:
			i += 1
			head_node = head_node.next
		return i


class Solution:

	def getCount(self, head_node):
		if head_node is None:
			return 0
		curr = head_node
		cnt = 0
		while curr:
			curr = curr.next
			cnt += 1
		return cnt


class Solution:

	def getCount(self, head_node):
		index = 0
		current = head_node
		while current:
			index += 1
			current = current.next
		return index


class Solution:

	def getCount(self, head_node):
		ct = 0
		while head_node:
			head_node = head_node.next
			ct += 1
		return ct


class Solution:

	def getCount(self, head):
		N = 1
		while head.next != None:
			head = head.next
			N += 1
		return N


class Solution:

	def getCount(self, head_node):
		dummy = head_node
		length = 0
		while dummy:
			dummy = dummy.next
			length += 1
		return length


class Solution:

	def getCount(self, head_node):
		counter = 1
		new_node = head_node
		if head_node.next == None:
			return counter
		else:
			while new_node.next != None:
				new_node = new_node.next
				counter = counter + 1
			return counter


class Solution:

	def getCount(self, head_node):
		count = 0
		curr = head_node
		while curr != None:
			count += 1
			curr = curr.next
		return count


class Solution:

	def getCount(self, head_node):
		count = 0
		if head_node == None:
			return count
		t = head_node
		while t != None:
			count += 1
			t = t.next
		return count


class Solution(object):

	def getCount(self, head):
		count = 0
		while head:
			count += 1
			head = head.next
		return count


class Solution:

	def getCount(self, head_node):
		i = 0
		a = head_node
		while a.next is not None:
			a = a.next
			i += 1
		return i + 1


class Solution:

	def getCount(self, head_node):
		if head_node == None:
			return 0
		result = 1
		while head_node.next:
			result += 1
			head_node = head_node.next
		return result


class Solution:

	def getCount(self, head_node):
		curr = head_node
		cou = 0
		while curr != None:
			if curr != None:
				cou += 1
			curr = curr.next
		return cou


class Solution:

	def getCount(self, head_node):
		count = 0
		n = head_node
		if head_node is None:
			return count
		else:
			while n.next is not None:
				count += 1
				n = n.next
			return count + 1


class Solution:

	def getCount(self, head_node):
		j = 0
		while head_node:
			j += 1
			head_node = head_node.next
		return j


class Solution:

	def getCount(self, head_node):
		if head_node is None:
			return 0
		k = 0
		while head_node:
			k += 1
			head_node = head_node.next
		return k


class Solution:

	def getCount(self, head_node):
		le = 0
		while head_node.next != None:
			le += 1
			head_node = head_node.next
		return le + 1


class Solution:

	def getCount(self, head_node):
		curr = head_node
		count = 1
		while curr.next is not None:
			curr = curr.next
			count += 1
		return count


class Solution:

	def getCount(self, head_node):
		c = 0
		temp = head_node
		if temp is None:
			return c
		else:
			while temp.next is not None:
				c += 1
				temp = temp.next
			c += 1
			return c


class Solution:

	def getCount(self, head_node):
		count = 1
		itr = head_node
		while itr.next:
			count += 1
			itr = itr.next
		return count


class Solution:

	def getCount(self, head):
		count = 0
		if head == None:
			return 0
		temp = head
		while temp.next != None:
			count += 1
			temp = temp.next
		return count + 1


class Solution:

	def getCount(self, head_node):
		len1 = 0
		while head_node is not None:
			len1 = len1 + 1
			head_node = head_node.next
		return len1