public void Test_Generic(string listStr, int k, string expectedStr) { var head = ListNodeHelper.BuildList(listStr); var sol = new Solution(); var res = sol.SplitListToParts(head, k); var expected = ListNodeHelper.BuildListArray(expectedStr); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }
public void Test_Generic(string inputStr, string expectedStr) { var head = ListNodeHelper.BuildList(inputStr); var expected = ListNodeHelper.BuildList(expectedStr); var sol = new Solution(); var res = sol.DeleteMiddle(head); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }
public void Test_GenericStr(string listStr, string expectedStr) { var head = ListNodeHelper.BuildList(listStr); var expected = ListNodeHelper.BuildList(expectedStr); var sol = new Solution(); var res = sol.DeleteDuplicates(head); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }
public void Test_Generic(string inputs, int val, string expectedStr) { var head = ListNodeHelper.BuildList(inputs); var sol = new Solution(); var res = sol.RemoveElements(head, val); var expected = ListNodeHelper.BuildList(expectedStr); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }
public void Test_Generic(string inputStr, string expectedStr) { var head = ListNodeHelper.BuildList(inputStr); var expected = ListNodeHelper.BuildList(expectedStr); var sol = new Solution(); sol.ReorderList(head); Assert.IsTrue(ListNodeHelper.AreEqual(head, expected)); }
public void Test_Stack(string listStr, string expectedStr) { var head = ListNodeHelper.BuildList(listStr); var sol = new Solution(); var res = sol.OddEvenList(head); var expected = ListNodeHelper.BuildList(expectedStr); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }
public void Test_Generic(string strList1, int a, int b, string strList2, string expected) { var list1 = ListNodeHelper.BuildList(strList1); var list2 = ListNodeHelper.BuildList(strList2); var expectedList = ListNodeHelper.BuildList(expected); var sol = new Solution(); var res = sol.MergeInBetween(list1, a, b, list2); Assert.IsTrue(ListNodeHelper.AreEqual(res, expectedList)); }
public void Test_Generic(string l1Str, string l2Str, string expectedStr) { var l1 = ListNodeHelper.BuildList(l1Str); var l2 = ListNodeHelper.BuildList(l2Str); var expected = ListNodeHelper.BuildList(expectedStr); var sol = new Solution(); var res = sol.AddTwoNumbers(l1, l2); Assert.IsTrue(ListNodeHelper.AreEqual(res, expected)); }