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

Method main

java/Chapter 2/Question2_5/QuestionB.java:72–93  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

70 }
71
72 public static void main(String[] args) {
73 LinkedListNode lA1 = new LinkedListNode(3, null, null);
74 LinkedListNode lA2 = new LinkedListNode(1, null, lA1);
75 LinkedListNode lA3 = new LinkedListNode(5, null, lA2);
76
77 LinkedListNode lB1 = new LinkedListNode(5, null, null);
78 LinkedListNode lB2 = new LinkedListNode(9, null, lB1);
79 LinkedListNode lB3 = new LinkedListNode(1, null, lB2);
80
81 LinkedListNode list3 = addLists(lA1, lB1);
82
83 System.out.println(" " + lA1.printForward());
84 System.out.println("+ " + lB1.printForward());
85 System.out.println("= " + list3.printForward());
86
87 int l1 = linkedListToInt(lA1);
88 int l2 = linkedListToInt(lB1);
89 int l3 = linkedListToInt(list3);
90
91 System.out.print(l1 + " + " + l2 + " = " + l3 + "\n");
92 System.out.print(l1 + " + " + l2 + " = " + (l1 + l2));
93 }
94}

Callers

nothing calls this directly

Calls 4

addListsMethod · 0.95
printForwardMethod · 0.95
linkedListToIntMethod · 0.95
printMethod · 0.45

Tested by

no test coverage detected