Our great sponsors
-
AdventOfCode2022
Solutions to all 25 Advent of Code 2022 in Rust 🦀 Less than 100 lines per day, total runtime of less than 1 second. (by AxlLind)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
There's a little more code than I want to paste here, so https://github.com/glguy/advent/blob/main/solutions/src/2022/15.hs
https://github.com/Sheinxy/Advent2022/blob/master/Day_15/day_15.hs ```hs module Main where
Still learning here, limited use of library functions; got to about 4s before calling it a day : HERE
part2 input = xb * gridSize + yb where sensors = fmap (uncurry sensor) input points = List.nub $ catMaybes $ intersection <$> (sensors >>= leftDiags) <*> (sensors >>= rightDiags) gridSize = 4000000 isValid (V2 x y) = 0 <= x && x <= gridSize && 0 <= y && y <= gridSize [V2 xb yb] = filter (\p -> isValid p && not (any (inRange p) sensors)) points ``` complete code