aoc2021

Advent of Code 2021 solutions in Perl.
git clone git://git.samirparikh.com/aoc2021
Log | Files | Refs | README

commit 2e35b4be3a9d6c289e36b6a60cd0421961c6d18b
parent 25c5ebeb639ec2eaa52b3804099dfd6d5a0eec99
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Fri,  3 Dec 2021 21:23:15 +0000

remove unneccesary print statements

Diffstat:
Mday03-2.pl | 12++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/day03-2.pl b/day03-2.pl @@ -33,7 +33,6 @@ while ( scalar ( @ogr ) > 1 ) { # while we still have more than one ogr my %count_0 = (); my %count_1 = (); foreach my $num (@ogr) { # iterate through each ogr candidate - #say $num->[$index]; if ($num->[$index]) { # bit at position index is 1 $count_1{$index}++; } else { @@ -42,7 +41,6 @@ while ( scalar ( @ogr ) > 1 ) { # while we still have more than one ogr } my $most_freq_bit = ($count_1{$index} >= $count_0{$index}) ? 1 : 0; - #say "mfbai = $most_freq_bit"; my $mfb_count; if ($most_freq_bit) { $mfb_count = $count_1{$index}; @@ -58,14 +56,8 @@ while ( scalar ( @ogr ) > 1 ) { # while we still have more than one ogr push( @temp_ogr, $num); } } - #foreach my $num (@ogr) { -# remove any candidates from ogr UNLESS the bit at the current index is -# the most frequent - #splice(@ogr, $index, 1) unless ($num->[$index] == $most_freq_bit); - #} - say "--- go to next index ---"; + @ogr = @temp_ogr; } - @ogr = (); } -#say @{$ogr[0]}; +say @{$ogr[0]};