public void FourSumWithTwoPointersWithIncrementAndDecrement_Success() { var expectedResult = new List <List <int> >() { new List <int>() { -1, 0, 0, 1 }, new List <int>() { -2, -1, 1, 2 }, new List <int>() { -2, 0, 0, 2 } }; int[] nums = new int[] { 1, 0, -1, 0, -2, 2 }; var result = new KSum().FourSumWithTwoPointersWithIncrementAndDecrement(nums); var areEqual = CollectionsAreEqual.AreEqualListOfLists(result, expectedResult); Assert.IsTrue(areEqual); }
public void TwoSumWithHashMap_Success() { int[] nums = new int[] { 2, 7, 11, 15 }; var expectedResult = new List <List <int> >() { new List <int>() { 0, 1 }, }; var result = new KSum().TwoSumWithHashMap(nums, 9); var areEqual = CollectionsAreEqual.AreEqualListOfLists(result, expectedResult); Assert.IsTrue(areEqual); }
public void ThreeSumWithTwoPointers_Success() { var expectedResult = new List <List <int> >() { new List <int>() { -1, 0, 1 }, new List <int>() { -1, -1, 2 } }; int[] nums = new int[] { -1, 0, 1, 2, -1, -4 }; var result = new KSum().ThreeSumWithTwoPointers(nums); var areEqual = CollectionsAreEqual.AreEqualListOfLists(result, expectedResult); Assert.IsTrue(areEqual); }
public void ThreeSumNaive_Success() { int[] nums = new int[] { -1, 0, 1, 2, -1, -4 }; var result = new KSum().ThreeSumNaive(nums); }