public void TestFrogRiverOne() { int s = _frogRiverOne.Solution(5, new int[] { 1, 3, 1, 4, 2, 3, 5, 4 }); Assert.AreEqual(6, s); s = _frogRiverOne.Solution(5, new int[] { 1, 1, 1, 2, 2, 3, 4, 4 }); Assert.AreEqual(-1, s); }
public void FrogRiverOneSolutionTest() { FrogRiverOne testPermCheck = new FrogRiverOne(); int[] arrayTest = new int[] { 1, 3, 1, 4, 2, 3, 5, 4 }; Assert.AreEqual(6, testPermCheck.Solution(5, arrayTest)); }
public void TestMethod1() { int x = 5; int[] input = { 1, 3, 1, 4, 2, 3, 5, 4 }; int expected = 6; int result = FrogRiverOne.Solution(x, input); Assert.AreEqual(expected, result); }
public void TestMethod3() { int x = 3; int[] input = { 1, 3, 1, 3, 2, 1 }; int expected = 4; int result = FrogRiverOne.Solution(x, input); Assert.AreEqual(expected, result); }
public void TestMethod2() { int x = 5; int[] input = { 3 }; int expected = -1; int result = FrogRiverOne.Solution(x, input); Assert.AreEqual(expected, result); }
public void SolutionTest_02() { var solution = new FrogRiverOne(); int[] A = new int[] { 1, 3, 1, 4, 2, 3, 5, 4 }; int X = 5; int expected = 6; int actual = solution.Solution(X, A); Assert.AreEqual(expected, actual); }
private static void RunFrogRiverOne() { Console.WriteLine($" --------- 4.2 FrogRiverOne --------- "); var result = FrogRiverOne.Solution(5, new int[] { 1, 3, 1, 4, 2, 3, 5, 4 }); Console.WriteLine($"result = {result}"); var result2 = FrogRiverOne.Solution(2, new int[] { 2, 2, 2 }); Console.WriteLine($"result = {result2}"); var result3 = FrogRiverOne.Solution(1, new int[] { 1 }); Console.WriteLine($"result = {result3}"); }
public void SolutionSimpleTest() { // Arrange int[] A = new int[] { 1, 3, 1, 4, 2, 3, 5, 4 }; int X = 5; // Action int actual = FrogRiverOne.Solution(X, A); // Assert int expected = 6; Assert.AreEqual(expected, actual); }
public void SolutionFrogCantCrossTest() { // Arrange int[] A = new int[] { 1, 1, 1, 1 }; int X = 5; // Action int actual = FrogRiverOne.Solution(X, A); // Assert int expected = -1; Assert.AreEqual(expected, actual); }
public void SolutionFrogCanCrossBigNumbersTest() { // Arrange int X = 100000; int[] A = new int[X]; for (int i = 0; i < X; i++) { A[i] = i + 1; } // Action int actual = FrogRiverOne.Solution(X, A); // Assert int expected = 99999; Assert.AreEqual(expected, actual); }
static void Main(string[] args) { Console.WriteLine($"BinaryGap is {BinaryGap.Solution(9)}"); Console.WriteLine($"BinaryGap is {BinaryGap.Solution(529)}"); Console.WriteLine($"BinaryGap is {BinaryGap.Solution(20)}"); Console.WriteLine($"BinaryGap is {BinaryGap.Solution(15)}"); Console.WriteLine($"BinaryGap is {BinaryGap.Solution(32)}"); Console.WriteLine($"BinaryGap is {BinaryGap.Solution(1041)}"); Console.WriteLine(Environment.NewLine); var result = CyclicRotation.Solution(new[] { 1, 2, 3, 4 }, 2); Console.WriteLine($"CyclicRotation: {string.Join('-', result)}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"OddOccurrencesInArray: {OddOccurrencesInArray.Solution(new[] {1, 1, 2, 2, 3, 4, 4})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"FrogJmp: {FrogJmp.Solution(10, 85, 30)}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"PermMissingElem: {PermMissingElem.Solution(new[] {6, 7, 8, 1, 2, 4, 5})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"TapeEquilibrium: {TapeEquilibrium.Solution(new[] {3,1,2,4,3})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"FrogRiverOne: {FrogRiverOne.Solution(5,new[] {1,3,1,4,2,3,6,5,4})}"); Console.WriteLine(Environment.NewLine); var maxCounter = MaxCounters.Solution(5, new[] { 3, 4, 4, 6, 1, 4, 4 }); Console.WriteLine($"MaxCounters: {string.Join('-', maxCounter)}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"MissingInteger: {MissingInteger.Solution(new []{1, 3, 6, 4, 1, 2})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"PermCheck: {PermCheck.Solution(new []{4,1,3,2})}"); Console.WriteLine($"PermCheck: {PermCheck.Solution(new []{4,1,3})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"CountDiv: {CountDiv.Solution(11, 345, 17)}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"PassingCars: {PassingCars.Solution(new []{0,1,0,1,1})}"); Console.WriteLine(Environment.NewLine); // Console.WriteLine($"MinAvgTwoSlice: {MinAvgTwoSlice.Solution(new []{4,2,2,5,1,5,8})}"); // Console.WriteLine(Environment.NewLine); // Console.WriteLine($"MaxProductOfThree: {MaxProductOfThree.Solution(new []{-3,1,2,-2,5,6})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"Triangle: {Triangle.Solution(new []{10,2,5,1,8,20})}"); Console.WriteLine($"Triangle: {Triangle.Solution(new []{10,50,5,1})}"); Console.WriteLine(Environment.NewLine); Console.WriteLine($"Brackets: {Brackets.Solution("{[()()]}")}"); Console.WriteLine($"Brackets: {Brackets.Solution("([)()]")}"); Console.WriteLine(Environment.NewLine); }
public void FrogRiverOne_OneLeaf_Success() { Assert.AreEqual(0, FrogRiverOne.Solution(1, new int[] { 1 })); }
public void FrogRiverOne_RepeatPosition_CannotJump_Success() { Assert.AreEqual(-1, FrogRiverOne.Solution(6, new int[] { 1, 3, 4, 3, 1, 4 })); }
public void FrogRiverOne_RepeatPosition_CanJump_Success() { Assert.AreEqual(5, FrogRiverOne.Solution(4, new int[] { 1, 3, 3, 1, 4, 2, 2 })); }
public void FrogRiverOne_SomeLeaves_CannotJump_Success() { Assert.AreEqual(-1, FrogRiverOne.Solution(4, new int[] { 1, 3, 4, 3 })); }