public void RunProblem() { var temp = SplitIntoFibonacci("123456579"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 123, 456, 579 })) { throw new Exception(); } temp = SplitIntoFibonacci("11235813"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 1, 1, 2, 3, 5, 8, 13 })) { throw new Exception(); } temp = SplitIntoFibonacci("112358130"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { })) { throw new Exception(); } temp = SplitIntoFibonacci("0123"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { })) { throw new Exception(); } temp = SplitIntoFibonacci("1101111"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 110, 1, 111 })) { throw new Exception(); } }
public void RunProblem() { var temp = NumSmallerByFrequency(new string[] { "cbd", }, new string[] { "zaaaz" }); if (!ProblemHelper.ArrayIsEqual(new int[] { 1 }, temp, false)) { throw new Exception(); } temp = NumSmallerByFrequency(new string[] { "bbb", "cc" }, new string[] { "a", "aa", "aaa", "aaaa" }); if (!ProblemHelper.ArrayIsEqual(new int[] { 1, 2 }, temp, false)) { throw new Exception(); } }
public void RunProblem() { var temp = LargestDivisibleSubset(new int[] { 1, 2, 3 }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 1, 2 })) { throw new Exception(); } temp = LargestDivisibleSubset(new int[] { 1, 2, 4, 8 }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 1, 2, 4, 8 })) { throw new Exception(); } temp = LargestDivisibleSubset(new int[] { }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { })) { throw new Exception(); } temp = LargestDivisibleSubset(new int[] { 4, 8, 10, 240 }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 4, 8, 240 })) { throw new Exception(); } }
public void RunProblem() { var temp = FindWords(new char[][] { new char[] { 'o', 'a', 'a', 'n' }, new char[] { 'e', 't', 'a', 'e' }, new char[] { 'i', 'h', 'k', 'r' }, new char[] { 'i', 'f', 'l', 'v' }, }, new string[] { "oath", "pea", "eat", "rain" }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new string[] { "eat", "oath" })) { throw new Exception(); } temp = FindWords(new char[][] { new char[] { 'a', 'a' } }, new string[] { "aaa" }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new string[] { "" })) { throw new Exception(); } }
public void RunProblem() { var temp = FindDisappearedNumbers(new int[] { 4, 3, 2, 7, 8, 2, 3, 1 }); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 5, 6 }, false)) { throw new Exception(); } }
public void RunProblem() { var temp = CountSmaller(new int[] { 5, 2, 6, 1 }); if (!ProblemHelper.ArrayIsEqual(new int[] { 2, 1, 1, 0 }, temp.ToArray(), false)) { throw new Exception(); } }
public void RunProblem() { var temp = Spellchecker(new string[] { "KiTe", "kite", "hare", "Hare" }, new string[] { "kite", "Kite", "KiTe", "Hare", "HARE", "Hear", "hear", "keti", "keet", "keto" }); if (!ProblemHelper.ArrayIsEqual(temp, new string[] { "kite", "KiTe", "KiTe", "Hare", "hare", "", "", "KiTe", "", "KiTe" }, false)) { throw new Exception(); } }
public void RunProblem() { var temp = FindErrorNums(new int[] { 1, 2, 2, 4 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 2, 3 })) { throw new Exception(); } }
public void RunProblem() { var temp = Intersect(new int[] { 1, 2, 2, 1 }, new int[] { 2, 2 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 2, 2 })) { throw new Exception(); } temp = Intersect(new int[] { 4, 9, 5 }, new int[] { 9, 4, 9, 8, 4 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 4, 9 })) { throw new Exception(); } }
public void RunProblem() { var temp = PrisonAfterNDays(new int[] { 0, 1, 0, 1, 1, 0, 0, 1 }, 7); if (!ProblemHelper.ArrayIsEqual(new int[] { 0, 0, 1, 1, 0, 0, 0, 0 }, temp)) { throw new Exception(); } temp = PrisonAfterNDays(new int[] { 1, 0, 0, 1, 0, 0, 1, 0 }, 1000000000); if (!ProblemHelper.ArrayIsEqual(new int[] { 0, 0, 1, 1, 1, 1, 1, 0 }, temp)) { throw new Exception(); } }
public void RunProblem() { var temp = FindAnagrams("cbaebabacd", "abc"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 0, 6 })) { throw new Exception(); } temp = FindAnagrams("abab", "ab"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 0, 1, 2 })) { throw new Exception(); } }
public void RunProblem() { var temp = CircularPermutation(2, 3); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 3, 2, 0, 1 })) { throw new Exception(); } temp = CircularPermutation(3, 2); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 2, 6, 7, 5, 4, 0, 1, 3 })) { throw new Exception(); } }
public void RunProblem() { var temp = HitBricks(new int[][] { new int[] { 1, 0, 0, 0 }, new int[] { 1, 1, 1, 0 } }, new int[][] { new int[] { 1, 0 } }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 2 })) { throw new Exception(); } temp = HitBricks(new int[][] { new int[] { 1, 0, 0, 0 }, new int[] { 1, 1, 0, 0 } }, new int[][] { new int[] { 1, 1 }, new int[] { 1, 0 } }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 0, 0 })) { throw new Exception(); } temp = HitBricks(new int[][] { new int[] { 1, 0, 1 }, new int[] { 1, 1, 1 } }, new int[][] { new int[] { 0, 0 }, new int[] { 0, 2 }, new int[] { 1, 1 } }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 0, 3, 0 })) { throw new Exception(); } }
public void RunProblem() { var temp = PowerfulIntegers(2, 3, 10); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 2, 3, 4, 5, 7, 9, 10 })) { throw new Exception(); } temp = PowerfulIntegers(3, 5, 15); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 2, 4, 6, 8, 10, 14 })) { throw new Exception(); } temp = PowerfulIntegers(2, 1, 10); }
public void RunProblem() { var temp = TopKFrequent(new int[] { 1, 1, 1, 2, 2, 3 }, 2); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 1, 2 })) { throw new Exception(); } temp = TopKFrequent(new int[] { 1 }, 1); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { 1 })) { throw new Exception(); } temp = TopKFrequent(new int[] { -1, -1 }, 1); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new int[] { -1 })) { throw new Exception(); } }
public void RunProblem() { var temp = PrintVertically("HOW ARE YOU"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new string[] { "HAY", "ORO", "WEU" })) { throw new Exception(); } temp = PrintVertically("TO BE OR NOT TO BE"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new string[] { "TBONTB", "OEROOE", " T" })) { throw new Exception(); } temp = PrintVertically("CONTEST IS COMING"); if (!ProblemHelper.ArrayIsEqual(temp.ToArray(), new string[] { "CIC", "OSO", "N M", "T I", "E N", "S G", "T" })) { throw new Exception(); } }
public void RunProblem() { var temp = ArrayRankTransform(new int[] { 40, 10, 20, 30 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 4, 1, 2, 3 }, false)) { throw new Exception(); } temp = ArrayRankTransform(new int[] { 100, 100, 100 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 1, 1, 1 }, false)) { throw new Exception(); } temp = ArrayRankTransform(new int[] { 37, 12, 28, 9, 100, 56, 80, 5, 12 }); if (!ProblemHelper.ArrayIsEqual(temp, new int[] { 5, 3, 4, 2, 8, 6, 7, 1, 3 }, false)) { throw new Exception(); } }