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

Method main

java/Chapter 2/Question2_5/QuestionA.java:40–61  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

38 }
39
40 public static void main(String[] args) {
41 LinkedListNode lA1 = new LinkedListNode(9, null, null);
42 LinkedListNode lA2 = new LinkedListNode(9, null, lA1);
43 LinkedListNode lA3 = new LinkedListNode(9, null, lA2);
44
45 LinkedListNode lB1 = new LinkedListNode(1, null, null);
46 LinkedListNode lB2 = new LinkedListNode(0, null, lB1);
47 LinkedListNode lB3 = new LinkedListNode(0, null, lB2);
48
49 LinkedListNode list3 = addLists(lA1, lB1, 0);
50
51 System.out.println(" " + lA1.printForward());
52 System.out.println("+ " + lB1.printForward());
53 System.out.println("= " + list3.printForward());
54
55 int l1 = linkedListToInt(lA1);
56 int l2 = linkedListToInt(lB1);
57 int l3 = linkedListToInt(list3);
58
59 System.out.print(l1 + " + " + l2 + " = " + l3 + "\n");
60 System.out.print(l1 + " + " + l2 + " = " + (l1 + l2));
61 }
62}

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