static void Main(string[] args) { var match = 0; var arr6 = new int[6]; for (int i = 183564; i <= 657474; i++) { i.SplitInto(arr6); if (Validate6.NeverDecrease(arr6) && Validate6.AtLeastTwoAdjacentDigitsAreSame(arr6)) { match++; } } Console.WriteLine($"Part1 different passwords: {match}"); // Part 2 match = 0; for (int i = 183564; i <= 657474; i++) { i.SplitInto(arr6); if (Validate6.NeverDecrease(arr6) && Validate6.TwoAdjacentDigitsAreSame(arr6)) { match++; } } Console.WriteLine($"Part2 different passwords: {match}"); }
public void TwoAdjacentDigitsAreSame_Negative(int num) { Assert.False(Validate6.TwoAdjacentDigitsAreSame(num.Split(6))); }
public void TwoAdjacentDigitsAreSame_Positive(int num) { Assert.True(Validate6.TwoAdjacentDigitsAreSame(num.Split(6))); }
public void Sometimes_Increase_6(int num) { Assert.False(Validate6.NeverDecrease(num.Split(6))); }
public void Never_Decrease_6(int num) { Assert.True(Validate6.NeverDecrease(num.Split(6))); }
public void Two_Adjacent_Digits_Are_Not_Same_6(int num) { Assert.False(Validate6.AtLeastTwoAdjacentDigitsAreSame(num.Split(6))); }