Challenge 4: Find the Length of a Linked List
Try to solve the Find the Length of a Linked List problem.
Statement
Given the head
of a singly linked list, find the length of the linked list.
Constraints:
Let n
be the number of nodes in a linked list.