Linked Lists - Length & Count
Linked Lists - Length & Count
Implement Length() to count the number of nodes in a linked list.
Implement Count() to count the occurrences of an integer in a linked list.
I've decided to bundle these two functions within the same Kata since they are both very similar.
The push()
/Push()
and buildOneTwoThree()
/BuildOneTwoThree()
functions do not need to be redefined.
Related Kata in order of expected completion (increasing difficulty): Linked Lists - Push & BuildOneTwoThree Linked Lists - Length & Count Linked Lists - Get Nth Node Linked Lists - Insert Nth Node Linked Lists - Sorted Insert Linked Lists - Insert Sort Linked Lists - Append Linked Lists - Remove Duplicates Linked Lists - Move Node Linked Lists - Move Node In-place Linked Lists - Alternating Split Linked Lists - Front Back Split Linked Lists - Shuffle Merge Linked Lists - Sorted Merge Linked Lists - Merge Sort Linked Lists - Sorted Intersect Linked Lists - Iterative Reverse Linked Lists - Recursive Reverse
Inspired by Stanford Professor Nick Parlante's excellent Linked List teachings.
Solutions
🧠 C++
Last updated
Was this helpful?