blog/assets/js/f48be158.f126906d.js

1 line
28 KiB
JavaScript
Raw Normal View History

"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[4064],{2326:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>r,metadata:()=>s,toc:()=>d});var o=t(5893),i=t(1151);const r={title:"3rd week of Advent of Code '22 in Rust",description:"Surviving third week in Rust.",date:"2023-07-06T21:00",slug:"aoc-2022/3rd-week",authors:"mf",tags:["advent-of-code","advent-of-code-2022","rust"],hide_table_of_contents:!1},a=void 0,s={permalink:"/blog/aoc-2022/3rd-week",editUrl:"https://github.com/mfocko/blog/tree/main/blog/aoc-2022/03-week-3.md",source:"@site/blog/aoc-2022/03-week-3.md",title:"3rd week of Advent of Code '22 in Rust",description:"Surviving third week in Rust.",date:"2023-07-06T21:00:00.000Z",formattedDate:"July 6, 2023",tags:[{label:"advent-of-code",permalink:"/blog/tags/advent-of-code"},{label:"advent-of-code-2022",permalink:"/blog/tags/advent-of-code-2022"},{label:"rust",permalink:"/blog/tags/rust"}],readingTime:11.565,hasTruncateMarker:!0,authors:[{name:"Matej Focko",email:"me+blog@mfocko.xyz",title:"a.k.a. @mf",url:"https://gitlab.com/mfocko",imageURL:"https://github.com/mfocko.png",key:"mf"}],frontMatter:{title:"3rd week of Advent of Code '22 in Rust",description:"Surviving third week in Rust.",date:"2023-07-06T21:00",slug:"aoc-2022/3rd-week",authors:"mf",tags:["advent-of-code","advent-of-code-2022","rust"],hide_table_of_contents:!1},unlisted:!1,prevItem:{title:"4th week of Advent of Code '22 in Rust",permalink:"/blog/aoc-2022/4th-week"},nextItem:{title:"Sort the matrix diagonally",permalink:"/blog/leetcode/sort-diagonally"}},l={authorsImageUrls:[void 0]},d=[{value:"Day 15: Beacon Exclusion Zone",id:"day-15-beacon-exclusion-zone",level:2},{value:"Solution",id:"solution",level:3},{value:"Day 16: Proboscidea Volcanium",id:"day-16-proboscidea-volcanium",level:2},{value:"Solution",id:"solution-1",level:3},{value:"Indexing in graph",id:"indexing-in-graph",level:4},{value:"Cartesian product",id:"cartesian-product",level:4},{value:"\u201cImplementing\u201d an iterator",id:"implementing-an-iterator",level:4},{value:"Day 17: Pyroclastic Flow",id:"day-17-pyroclastic-flow",level:2},{value:"Solution",id:"solution-2",level:3},{value:"Collision detection",id:"collision-detection",level:4},{value:"Infinite iterator",id:"infinite-iterator",level:4},{value:"Day 18: Boiling Boulders",id:"day-18-boiling-boulders",level:2},{value:"Solution",id:"solution-3",level:3},{value:"Day 19: Not Enough Minerals",id:"day-19-not-enough-minerals",level:2},{value:"Solution",id:"solution-4",level:3},{value:"Day 20: Grove Positioning System",id:"day-20-grove-positioning-system",level:2},{value:"Solution",id:"solution-5",level:3},{value:"<code>.borrow_mut()</code>",id:"borrow_mut",level:4},{value:"<code>.borrow_mut()</code> on <code>Rc&lt;RefCell&lt;T&gt;&gt;</code>",id:"borrow_mut-on-rcrefcellt",level:5},{value:"<code>BorrowMut</code> trait",id:"borrowmut-trait",level:5},{value:"Conflict",id:"conflict",level:5},{value:"Day 21: Monkey Math",id:"day-21-monkey-math",level:2},{value:"Solution",id:"solution-6",level:3},{value:"<code>Default</code> trait",id:"default-trait",level:4},{value:"Abusing negation",id:"abusing-negation",level:4}];function c(e){const n={a:"a",admonition:"admonition",blockquote:"blockquote",code:"code",em:"em",h2:"h2",h3:"h3",h4:"h4",h5:"h5",li:"li",ol:"ol",p:"p",pre:"pre",section:"section",strong:"strong",sup:"sup",ul:"ul",...(0,i.a)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.p,{children:["Let's go through the third week of ",(0,o.jsx)(n.a,{href:"https://adventofcode.com",children:(0,o.jsx)(n.em,{children:"Advent of Code"})})," in Rust."]}),"\n",(0,o.jsx)(n.h2,{id:"day-15-beacon-exclusion-zone",children:(0,o.jsx)(n.a,{href:"https://adventofcode.com/2022/day/15",children:"Day 15: Beacon Exclusion Zone"})}),"\n",(0,o.jsx)(n.admonition,{title:"tl;dr",type:"info",children:(0,o.jsx)(n.p,{children:"Triangulating a distress beacon based on the information from the sensors."})}),"\n",(0,o.jsx)(n.h3,{id:"solution",children:"Solution"}),"\n",(0,o.jsx)(n.p,{children: