public void LongestCommonStringTest() { string a = "zxabcdezy", b = "yzabcdezx"; Batch4 b4 = new Batch4(); int len = b4.LongestCommonString(a, b); }
public void MinSwapTest() { int[] A = { 1, 3, 5, 4 }; int[] B = { 1, 2, 3, 7 }; Batch4 b4 = new Batch4(); int num = b4.MinSwap(A, B); }
public void FindMin2Test() { Batch4 b4 = new Batch4(); int[] nums = { 2, 0, 1, 1, 1 }; int min = b4.FindMin2(nums); }
public void FindItineraryTest() { Batch4 b4 = new Batch4(); //[["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]] IList <IList <string> > tickets = new List <IList <string> >(); List <string> tempList; tempList = new List <string>(); tempList.Add("MUC"); tempList.Add("LHR"); tickets.Add(tempList); tempList = new List <string>(); tempList.Add("JFK"); tempList.Add("MUC"); tickets.Add(tempList); tempList = new List <string>(); tempList.Add("SFO"); tempList.Add("SJC"); tickets.Add(tempList); tempList = new List <string>(); tempList.Add("LHR"); tempList.Add("SFO"); tickets.Add(tempList); IList <string> routes = b4.FindItinerary(tickets); }
public void KnapsackTest() { int[] weight = { 5, 4, 6, 7 }; int[] value = { 10, 40, 30, 70 }; Batch4 b4 = new Batch4(); int max = b4.Knapsack(weight.Length, 9, weight, value); }
public void UniquePathsWithObstaclesTest() { //[[0,0,0],[0,1,0],[0,0,0]] int[][] arr = new int[][] { new int[] { 0, 0, 0 }, new int[] { 0, 1, 0 }, new int[] { 0, 0, 0 } }; Batch4 b4 = new Batch4(); int nPaths = b4.UniquePathsWithObstacles(arr); }
public void FindLongestChainTest() { //[[-6,9],[1,6],[8,10],[-1,4],[-6,-2],[-9,8],[-5,3],[0,3]] Batch4 b4 = new Batch4(); int[][] pairs = new int[][] { new int[] { -6, 9 }, new int[] { 1, 6 }, new int[] { 8, 10 }, new int[] { -1, 4 }, new int [] { -6, -2 }, new int [] { -9, 8 }, new int [] { -5, 3 }, new int [] { 0, 3 } }; b4.FindLongestChain(pairs); }
public void LongestValidParenthesesTest() { Batch4 b4 = new Batch4(); int l = b4.LongestValidParentheses("()(())"); }
public void SolveNQueensTest() { Batch4 b4 = new Batch4(); IList <IList <string> > result = b4.SolveNQueens(4); }
public void FindNumberOfLISTest() { int[] a = { 1, 2, 4, 3, 5, 4, 7, 2 }; Batch4 b4 = new Batch4(); int result = b4.FindNumberOfLIS(a); }
public void NumTilingsTest() { int n = 30; Batch4 b4 = new Batch4(); int v = b4.NumTilings(30); }
public void FrequencySortTest() { Batch4 b4 = new Batch4(); string result = b4.FrequencySort("aDDbbbcAc"); }