MCPcopy Create free account
hub / github.com/careercup/ctci / lengthOfLinkedlist

Function lengthOfLinkedlist

python/Chapter 2/Question2_5.py:90–96  ·  view source on GitHub ↗
(linkedlist)

Source from the content-addressed store, hash-verified

88
89# Helper function to caculate length of a linked list
90def lengthOfLinkedlist(linkedlist):
91 length = 0
92 current = linkedlist.head
93 while current != None:
94 length += 1
95 current = current.next
96 return length
97
98
99# Helper funtion to pad the list with zeros in front

Callers 1

addLists_fwd_2Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected