@@ -57,7 +57,7 @@ private void ProcessOperand(string operand, long multiplyCountBy)
5757
5858public static class AlphameticsSolver
5959{
60- private static AlphameticsEquation _equation ;
60+ private static AlphameticsEquation ? _equation ;
6161
6262 public static IDictionary < char , int > Solve ( AlphameticsEquation equation )
6363 {
@@ -77,19 +77,19 @@ private static bool IsSolution(int[] letterCountCombination)
7777 if ( LetterCountHasInvalidNonZeroLetter ( ) )
7878 return false ;
7979
80- return _equation . LettersWithCount . Values
80+ return _equation ! . LettersWithCount . Values
8181 . Zip ( letterCountCombination , ( count , solutionCount ) => count * solutionCount ) . Sum ( ) == 0 ;
8282
8383 bool LetterCountHasInvalidNonZeroLetter ( )
8484 {
8585 var zeroLetterIndex = Array . IndexOf ( letterCountCombination , 0 ) ;
86- return zeroLetterIndex != - 1 && _equation . NonZeroLetters . Contains ( _equation . LettersWithCount . Keys . ElementAt ( zeroLetterIndex ) ) ;
86+ return zeroLetterIndex != - 1 && _equation ! . NonZeroLetters . Contains ( _equation . LettersWithCount . Keys . ElementAt ( zeroLetterIndex ) ) ;
8787 }
8888 }
8989
9090 private static Dictionary < char , int > SolutionForLetterCount ( IEnumerable < int > letterCount )
9191 => letterCount
92- . Zip ( _equation . LettersWithCount . Keys , ( x , y ) => new KeyValuePair < char , int > ( y , x ) )
92+ . Zip ( _equation ! . LettersWithCount . Keys , ( x , y ) => new KeyValuePair < char , int > ( y , x ) )
9393 . ToDictionary ( x => x . Key , x => x . Value ) ;
9494}
9595
0 commit comments