Class SolutionDay1
java.lang.Object
com.expedient.adventofcodejade.BaseSolution
com.expedient.adventofcodejade.solutions.year2024.SolutionDay1
-
Constructor Summary
ConstructorsConstructorDescriptionSolutionDay1(PuzzleInput input, PuzzleInput sampleInputOne, PuzzleInput sampleInputTwo) -
Method Summary
Modifier and TypeMethodDescriptionpartOne(PuzzleInput inputUsed) Get two Integer lists, corresponding to each column of the input.partTwo(PuzzleInput inputUsed) Get two Integer lists, corresponding to each column of the input.Methods inherited from class com.expedient.adventofcodejade.BaseSolution
getInput, run
-
Constructor Details
-
SolutionDay1
-
-
Method Details
-
partOne
Get two Integer lists, corresponding to each column of the input. Sort both lists. Compare each item in each list and add up the total distance.- Specified by:
partOnein classBaseSolution- Parameters:
inputUsed- the PuzzleInput to be used for the solution- Returns:
- string with the total distance between the numbers in each list
-
partTwo
Get two Integer lists, corresponding to each column of the input. Create a third Integer list. Sort both lists, then populate it with each number in the first list multiplied by the number of times it appears in the second.- Specified by:
partTwoin classBaseSolution- Parameters:
inputUsed- the PuzzleInput to be used for the solution- Returns:
- the sum of frequencies of the numbers in column 1 in column 2
-