Class SolutionDay4
java.lang.Object
com.expedient.adventofcodejade.BaseSolution
com.expedient.adventofcodejade.solutions.year2024.SolutionDay4
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionDay4(PuzzleInput input, PuzzleInput sampleInputOne, PuzzleInput sampleInputTwo) -
Method Summary
Modifier and TypeMethodDescriptionpartOne(PuzzleInput input) Find all 'X' Characters in the input grid, then find surrounding 'M' Characters for each one.partTwo(PuzzleInput input) Find each 'A' Character in the input grid.Methods inherited from class com.expedient.adventofcodejade.BaseSolution
getInput, run
-
Constructor Details
-
SolutionDay4
-
-
Method Details
-
partOne
Find all 'X' Characters in the input grid, then find surrounding 'M' Characters for each one. After this, continue in the same direction as the 'M' to look for 'A' and then 'S'. Count each full occurrence.- Specified by:
partOnein classBaseSolution- Parameters:
input- the PuzzleInput to be used for the solution- Returns:
- the number of times that XMAS was found in the input
-
partTwo
Find each 'A' Character in the input grid. For each one, find non-orthogonal neighbors that are 'M' characters. Then, for each 'M' neighbor, check for 'S' in the opposite direction. If there are two 'MAS' sequences, add to the count.- Specified by:
partTwoin classBaseSolution- Parameters:
input- the PuzzleInput to be used for the solution- Returns:
- the number of times X-MASes were found in the input
-