Problem statement
Given the head of a singly linked list of integers, find and return its length.
public static int length(Node head){
while(head != null{
count++;
head = head.next;
}
}
}
Given the head of a singly linked list of integers, find and return its length.
Comments
Post a Comment