public void GetIntersectionNode(ListNode headA, ListNode headB, ListNode expected) { var sut = new IntersectionOfTwoLinkedLists(); var actual = sut.GetIntersectionNode(headA, headB); Assert.AreEqual(expected, actual); }
public void GetIntersectionNodeTestCase2() { var listA = CommonHelpers.GetLinkedListFromArray(new[] { 1, 51 }); var listB = CommonHelpers.GetLinkedListFromArray(new[] { 2, 4, 6, 51 }); var intersectionValue = 51; CommonHelpers.MakeIntersection(intersectionValue, listA, listB, 1, 3); IntersectionOfTwoLinkedLists.GetIntersectionNode(listA, listB).Value.Should().Be(intersectionValue); }
public void GetIntersectionNodeTestCase1() { var listA = CommonHelpers.GetLinkedListFromArray(new[] { 4, 1, 8, 4, 5 }); var listB = CommonHelpers.GetLinkedListFromArray(new[] { 5, 6, 1, 8, 4, 5 }); var intersectionValue = 8; CommonHelpers.MakeIntersection(intersectionValue, listA, listB, 2, 3); IntersectionOfTwoLinkedLists.GetIntersectionNode(listA, listB).Value.Should().Be(intersectionValue); }
public void Setup() { solution = new IntersectionOfTwoLinkedLists(); }