This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module DayFour (module DayFour) where | |
import qualified Data.Text as T | |
import qualified Text.Read as TR | |
import qualified Data.Maybe as M | |
import qualified Data.Set as S | |
extractNumbers :: T.Text -> [Int] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DayThree (module DayThree) where | |
import qualified Data.Text as T | |
import qualified Text.Read as TR | |
import qualified Data.Foldable as DF | |
import qualified Data.Maybe as M | |
import qualified Data.List.Safe as LS | |
import qualified Data.Set as S | |
import qualified Data.List as L | |
import qualified Data.Text.IO as TI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module DayTwo | |
( partOne, greenCount, legalDraw, legalGame, partOneCheckRow, gameId, power, partTwo | |
) where | |
import qualified Data.Text as T | |
import qualified Data.List.Safe as LS | |
import qualified Data.Text.IO as TI | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DayOne | |
( partOne, decodeLine, substringIndices, Digit (..), operateOnString, toLower, allDigits, firstDigit, lastDigit, scoreDigit, scoreLine, partTwo | |
) where | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as TI | |
import qualified Data.Maybe as M | |
import qualified Data.List as L | |
import qualified Data.List.Safe as LS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import functools | |
class Subgrid: | |
def __init__(self, row, column): | |
self.row = row | |
self.column = column | |
def indices(self): | |
return [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def indices(s,t) | |
# indices('abcHellodefHello', 'Hello') | |
# => [3,11] | |
found = s.index(t) | |
if found | |
offset = 1 + found | |
return [found] + indices(s[offset..], t).map {|e| e + offset} | |
else | |
return [] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cycles(size, depth=0): | |
# we use (x,y) notation | |
if size < 2: | |
return iter([]) | |
not_aware_of_depth = (cycle(offset, size) for offset in range(0, size - 1)) | |
cycles_at_current_depth = ( | |
(go_right(go_down(p, depth), depth) for p in cycle) | |
for cycle in not_aware_of_depth | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module DayFifteen | |
( main | |
) where | |
import qualified Data.Maybe as M | |
import qualified Data.Ord as O | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as TI | |
import qualified Data.List as L | |
import qualified Data.List.Split as LS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DayFourteen | |
( main | |
) where | |
import qualified Data.Maybe as M | |
import qualified Data.Ord as O | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as TI | |
import qualified Data.List as L | |
import qualified Data.List.Split as LS | |
import qualified Data.Set as S |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DayThirteen | |
( main | |
) where | |
import qualified Data.Maybe as M | |
import qualified Data.Ord as O | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as TI | |
import qualified Data.List as L | |
import qualified Data.List.Split as LS | |
import qualified Data.Function as F |