MCPcopy Index your code
hub / github.com/careercup/ctci / length

Method length

java/Chapter 2/Question2_5/QuestionB.java:5–11  ·  view source on GitHub ↗
(LinkedListNode l)

Source from the content-addressed store, hash-verified

3
4public class QuestionB {
5 private static int length(LinkedListNode l) {
6 if (l == null) {
7 return 0;
8 } else {
9 return 1 + length(l.next);
10 }
11 }
12
13 private static PartialSum addListsHelper(LinkedListNode l1, LinkedListNode l2) {
14 if (l1 == null && l2 == null) {

Callers 1

addListsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected