7 kyu
Fun with lists: length
1,448 of 3,454janitormeir
Description:
Implement the method length, which accepts a linked list (head), and returns the length of the list.
For example:
Given the list: 1 -> 2 -> 3 -> 4
, length should return 4.
The linked list is defined as follows:
function Node(data, next = null) {
this.data = data;
this.next = next;
}
Note: the list may be null and can hold any type of value.
Good luck!
This kata is part of fun with lists series:
Lists
Fundamentals
Similar Kata:
Stats:
Created | Nov 5, 2016 |
Published | Nov 5, 2016 |
Warriors Trained | 7538 |
Total Skips | 317 |
Total Code Submissions | 9765 |
Total Times Completed | 3454 |
JavaScript Completions | 1448 |
Java Completions | 825 |
PHP Completions | 179 |
Python Completions | 914 |
C Completions | 127 |
C++ Completions | 160 |
Total Stars | 73 |
% of votes with a positive feedback rating | 91% of 615 |
Total "Very Satisfied" Votes | 526 |
Total "Somewhat Satisfied" Votes | 70 |
Total "Not Satisfied" Votes | 19 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |