Class SolutionDay1

java.lang.Object
com.expedient.adventofcodejade.BaseSolution
com.expedient.adventofcodejade.solutions.year2024.SolutionDay1

public class SolutionDay1 extends BaseSolution
  • Constructor Details

  • Method Details

    • partOne

      public Integer partOne(PuzzleInput inputUsed)
      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:
      partOne in class BaseSolution
      Parameters:
      inputUsed - the PuzzleInput to be used for the solution
      Returns:
      string with the total distance between the numbers in each list
    • partTwo

      public Integer partTwo(PuzzleInput inputUsed)
      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:
      partTwo in class BaseSolution
      Parameters:
      inputUsed - the PuzzleInput to be used for the solution
      Returns:
      the sum of frequencies of the numbers in column 1 in column 2