1
0
Fork 0
mirror of https://github.com/mfocko/blog.git synced 2025-05-05 10:52:59 +02:00
This commit is contained in:
github-actions[bot] 2024-01-06 16:30:44 +00:00
parent 1d4ae5f520
commit 00c23a0553
148 changed files with 146 additions and 146 deletions
404.html
algorithms
algorithms-correctness/postcondition-ambiguity
category
algorithms-and-correctness
asymptotic-notation-and-time-complexity
graphs
hash-tables
paths-in-graphs
recursion
red-black-trees
graphs
bfs-tree
iterative-and-iterators
hash-tables/breaking
index.html
paths/bf-to-astar
rb-trees
applications
rules
recursion
karel
pyramid-slide-down
bottom-up-dp
greedy
index.html
naive
top-down-dp
tags
a-star
applications
astar
backtracking
balanced-trees
bellman-ford
bfs
bottom-up-dp
brute-force
c
cpp
csharp
dijkstra
dynamic-array
dynamic-programming
exponential
graphs
greedy
hash-tables
index.html
iterative
iterators
java
karel
postconditions
python
recursion
red-black-trees
solution
sorting
testing
time-complexity
top-down-dp
time-complexity/extend
assets/js
blog
2023/08/02/copr
aoc-2022
1st-week
2nd-week
3rd-week
4th-week
intro
archive
atom.xmlfeed.jsonindex.html
leetcode/sort-diagonally
rss.xml
tags
admin
advent-of-code-2022
advent-of-code
copr
cpp

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -18,7 +18,7 @@ correctness.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -18,7 +18,7 @@ something.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

File diff suppressed because one or more lines are too long

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -16,7 +16,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[9731],{42286:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var o=n(85893),r=n(11151);const i={id:"cpp-intro",title:"Introduction",slug:"/"},c=void 0,a={id:"cpp-intro",title:"Introduction",description:"",source:"@site/cpp/00-intro.md",sourceDirName:".",slug:"/",permalink:"/cpp/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/cpp/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704291155,formattedLastUpdatedAt:"Jan 3, 2024",sidebarPosition:0,frontMatter:{id:"cpp-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Exceptions and RAII",permalink:"/cpp/category/exceptions-and-raii"}},s={},p=[];function u(t){return(0,o.jsx)(o.Fragment,{})}function d(t={}){const{wrapper:e}={...(0,r.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(u,{...t})}):u()}},11151:(t,e,n)=>{n.d(e,{Z:()=>a,a:()=>c});var o=n(67294);const r={},i=o.createContext(r);function c(t){const e=o.useContext(i);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function a(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:c(t.components),o.createElement(i.Provider,{value:e},t.children)}}}]);
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[9731],{42286:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var o=n(85893),r=n(11151);const i={id:"cpp-intro",title:"Introduction",slug:"/"},c=void 0,a={id:"cpp-intro",title:"Introduction",description:"",source:"@site/cpp/00-intro.md",sourceDirName:".",slug:"/",permalink:"/cpp/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/cpp/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704558496,formattedLastUpdatedAt:"Jan 6, 2024",sidebarPosition:0,frontMatter:{id:"cpp-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Exceptions and RAII",permalink:"/cpp/category/exceptions-and-raii"}},s={},p=[];function u(t){return(0,o.jsx)(o.Fragment,{})}function d(t={}){const{wrapper:e}={...(0,r.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(u,{...t})}):u()}},11151:(t,e,n)=>{n.d(e,{Z:()=>a,a:()=>c});var o=n(67294);const r={},i=o.createContext(r);function c(t){const e=o.useContext(i);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function a(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:c(t.components),o.createElement(i.Provider,{value:e},t.children)}}}]);

View file

@ -1 +1 @@
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[3803],{86427:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var o=n(85893),r=n(11151);const i={id:"c-intro",title:"Introduction",slug:"/"},s=void 0,c={id:"c-intro",title:"Introduction",description:"",source:"@site/c/00-intro.md",sourceDirName:".",slug:"/",permalink:"/c/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/c/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704291155,formattedLastUpdatedAt:"Jan 3, 2024",sidebarPosition:0,frontMatter:{id:"c-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Bonuses",permalink:"/c/category/bonuses"}},a={},u=[];function d(t){return(0,o.jsx)(o.Fragment,{})}function l(t={}){const{wrapper:e}={...(0,r.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(d,{...t})}):d()}},11151:(t,e,n)=>{n.d(e,{Z:()=>c,a:()=>s});var o=n(67294);const r={},i=o.createContext(r);function s(t){const e=o.useContext(i);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:s(t.components),o.createElement(i.Provider,{value:e},t.children)}}}]);
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[3803],{86427:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>a,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var o=n(85893),r=n(11151);const i={id:"c-intro",title:"Introduction",slug:"/"},s=void 0,c={id:"c-intro",title:"Introduction",description:"",source:"@site/c/00-intro.md",sourceDirName:".",slug:"/",permalink:"/c/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/c/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704558496,formattedLastUpdatedAt:"Jan 6, 2024",sidebarPosition:0,frontMatter:{id:"c-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Bonuses",permalink:"/c/category/bonuses"}},a={},u=[];function d(t){return(0,o.jsx)(o.Fragment,{})}function l(t={}){const{wrapper:e}={...(0,r.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(d,{...t})}):d()}},11151:(t,e,n)=>{n.d(e,{Z:()=>c,a:()=>s});var o=n(67294);const r={},i=o.createContext(r);function s(t){const e=o.useContext(i);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function c(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(r):t.components||r:s(t.components),o.createElement(i.Provider,{value:e},t.children)}}}]);

View file

@ -1 +1 @@
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[1885],{49713:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var o=n(85893),s=n(11151);const r={id:"algorithms-intro",title:"Introduction",slug:"/"},i=void 0,a={id:"algorithms-intro",title:"Introduction",description:"In this part you can find \u201crandom\u201d additional materials I have written over the",source:"@site/algorithms/00-intro.md",sourceDirName:".",slug:"/",permalink:"/algorithms/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/algorithms/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704291155,formattedLastUpdatedAt:"Jan 3, 2024",sidebarPosition:0,frontMatter:{id:"algorithms-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Algorithms and Correctness",permalink:"/algorithms/category/algorithms-and-correctness"}},c={},d=[];function l(t){const e={a:"a",em:"em",p:"p",...(0,s.a)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.p,{children:["In this part you can find \u201crandom\u201d additional materials I have written over the\ncourse of teaching ",(0,o.jsx)(e.em,{children:"Algorithms and data structures I"}),"."]}),"\n",(0,o.jsx)(e.p,{children:"It is a various mix of stuff that may have been produced as a follow-up on some\nquestion asked at the seminar or spontanously."}),"\n",(0,o.jsxs)(e.p,{children:["If you have some ideas for posts, please do not hesitate to submit them as issues\nin the linked ",(0,o.jsx)(e.a,{href:"https://gitlab.fi.muni.cz/xfocko/kb/issues",children:"GitLab"}),"."]})]})}function u(t={}){const{wrapper:e}={...(0,s.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(l,{...t})}):l(t)}},11151:(t,e,n)=>{n.d(e,{Z:()=>a,a:()=>i});var o=n(67294);const s={},r=o.createContext(s);function i(t){const e=o.useContext(r);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function a(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(s):t.components||s:i(t.components),o.createElement(r.Provider,{value:e},t.children)}}}]);
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[1885],{49713:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var o=n(85893),s=n(11151);const r={id:"algorithms-intro",title:"Introduction",slug:"/"},i=void 0,a={id:"algorithms-intro",title:"Introduction",description:"In this part you can find \u201crandom\u201d additional materials I have written over the",source:"@site/algorithms/00-intro.md",sourceDirName:".",slug:"/",permalink:"/algorithms/",draft:!1,unlisted:!1,editUrl:"https://github.com/mfocko/blog/tree/main/algorithms/00-intro.md",tags:[],version:"current",lastUpdatedAt:1704558496,formattedLastUpdatedAt:"Jan 6, 2024",sidebarPosition:0,frontMatter:{id:"algorithms-intro",title:"Introduction",slug:"/"},sidebar:"autogeneratedBar",next:{title:"Algorithms and Correctness",permalink:"/algorithms/category/algorithms-and-correctness"}},c={},d=[];function l(t){const e={a:"a",em:"em",p:"p",...(0,s.a)(),...t.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(e.p,{children:["In this part you can find \u201crandom\u201d additional materials I have written over the\ncourse of teaching ",(0,o.jsx)(e.em,{children:"Algorithms and data structures I"}),"."]}),"\n",(0,o.jsx)(e.p,{children:"It is a various mix of stuff that may have been produced as a follow-up on some\nquestion asked at the seminar or spontanously."}),"\n",(0,o.jsxs)(e.p,{children:["If you have some ideas for posts, please do not hesitate to submit them as issues\nin the linked ",(0,o.jsx)(e.a,{href:"https://gitlab.fi.muni.cz/xfocko/kb/issues",children:"GitLab"}),"."]})]})}function u(t={}){const{wrapper:e}={...(0,s.a)(),...t.components};return e?(0,o.jsx)(e,{...t,children:(0,o.jsx)(l,{...t})}):l(t)}},11151:(t,e,n)=>{n.d(e,{Z:()=>a,a:()=>i});var o=n(67294);const s={},r=o.createContext(s);function i(t){const e=o.useContext(r);return o.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function a(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(s):t.components||s:i(t.components),o.createElement(r.Provider,{value:e},t.children)}}}]);

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[8091],{66765:(e,t,o)=>{o.r(t),o.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>c});var n=o(85893),a=o(11151);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},i=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"}},d={authorsImageUrls:[void 0]},c=[];function l(e){const t={em:"em",p:"p",...(0,a.a)(),...e.components};return(0,n.jsxs)(t.p,{children:["Let's go through the third week of [",(0,n.jsx)(t.em,{children:"Advent of Code"}),"] in Rust."]})}function u(e={}){const{wrapper:t}={...(0,a.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},11151:(e,t,o)=>{o.d(t,{Z:()=>s,a:()=>i});var n=o(67294);const a={},r=n.createContext(a);function i(e){const t=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]);

View file

@ -0,0 +1 @@
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[8091],{66765:(e,t,o)=>{o.r(t),o.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>c});var n=o(85893),a=o(11151);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},i=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.57,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"}},d={authorsImageUrls:[void 0]},c=[];function l(e){const t={em:"em",p:"p",...(0,a.a)(),...e.components};return(0,n.jsxs)(t.p,{children:["Let's go through the third week of [",(0,n.jsx)(t.em,{children:"Advent of Code"}),"] in Rust."]})}function u(e={}){const{wrapper:t}={...(0,a.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(l,{...e})}):l(e)}},11151:(e,t,o)=>{o.d(t,{Z:()=>s,a:()=>i});var n=o(67294);const a={},r=n.createContext(a);function i(e){const t=n.useContext(r);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function s(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:i(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
@ -118,7 +118,7 @@ Find how many overlap and can take the day off.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="day-5-supply-stacks"><a href="https://adventofcode.com/2022/day/5" target="_blank" rel="noopener noreferrer">Day 5: Supply Stacks</a><a href="#day-5-supply-stacks" class="hash-link" aria-label="Direct link to day-5-supply-stacks" title="Direct link to day-5-supply-stacks"></a></h2>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>tl;dr</div><div class="admonitionContent_BuS1"><p>Let&#x27;s play with stacks of crates.</p></div></div>
<p>Very easy problem with very annoying input. You can judge yourself:</p>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3 </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Good luck transforming that into something reasonable :)</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Fun fact</div><div class="admonitionContent_BuS1"><p>Took me 40 minutes to parse this reasonably, including fighting the compiler.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="solution-4">Solution<a href="#solution-4" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution"></a></h3>

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
@ -302,7 +302,7 @@ right? Yes… but actually no <!-- -->😦</p>
the fun part consists of the fact that in other place, where we were using it,
we were passing the <code>&amp;[Vec&lt;T&gt;]</code>, but this is coming from a helper functions that
take <code>&amp;Vec&lt;Vec&lt;T&gt;&gt;</code> instead. And… we don&#x27;t implement <code>Index</code> and <code>IndexMut</code> for
those. Just for the slices. <!-- -->🤯<!-- --> <em>What are we going to do about it?</em></p>
those. Just for the slices. 🤯 <em>What are we going to do about it?</em></p>
<p>We can either start copy-pasting or be smarter about it… I choose to be smarter,
so let&#x27;s implement a macro! The only difference across the implementations are
the types of the outer containers. Implementation doesn&#x27;t differ <strong>at all</strong>!</p>

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
@ -230,7 +230,7 @@ everything:</p>
<p>You can also see that it simplifies the meaning a bit and it is more explicit than
the previous versions.</p>
<p>And for the tests:</p>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="summary">Summary<a href="#summary" class="hash-link" aria-label="Direct link to Summary" title="Direct link to Summary"></a></h2>
<p>Let&#x27;s wrap the whole thing up! Keeping in mind both AoC and the Rust…</p>
<p><img loading="lazy" alt="Finished advent calendar :smile:" src="/assets/images/calendar-f891b624f3e0efb34bba582100a7d8df.png" width="2417" height="1984" class="img_ev3q"></p>

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -317,7 +317,7 @@ everything:</p>
<p>You can also see that it simplifies the meaning a bit and it is more explicit than
the previous versions.</p>
<p>And for the tests:</p>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="summary">Summary<a href="https://blog.mfocko.xyz/blog/aoc-2022/4th-week#summary" class="hash-link" aria-label="Direct link to Summary" title="Direct link to Summary"></a></h2>
<p>Let's wrap the whole thing up! Keeping in mind both AoC and the Rust…</p>
<p><img loading="lazy" alt="Finished advent calendar :smile:" src="https://blog.mfocko.xyz/assets/images/calendar-f891b624f3e0efb34bba582100a7d8df.png" width="2417" height="1984" class="img_ev3q"></p>
@ -591,7 +591,7 @@ order and return the resulting matrix.</p>
<p><img loading="lazy" src="https://assets.leetcode.com/uploads/2020/01/21/1482_example_1_2.png" alt="Image describing the problem" class="img_ev3q"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="skeleton-and-initial-adjustments">Skeleton and initial adjustments<a href="https://blog.mfocko.xyz/blog/leetcode/sort-diagonally#skeleton-and-initial-adjustments" class="hash-link" aria-label="Direct link to Skeleton and initial adjustments" title="Direct link to Skeleton and initial adjustments"></a></h2>
<p>We are given the following skeleton for the C++ and the given challenge:</p>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>The task is to sort the passed matrix diagonally and then return it. First of all,
I don't like to solve this in a web browser, so we'll need to adjust it accordingly
for running it locally. We'll start by including the <code>vector</code> header and using
@ -1078,7 +1078,7 @@ right? Yes… but actually no <!-- -->😦</p>
the fun part consists of the fact that in other place, where we were using it,
we were passing the <code>&amp;[Vec&lt;T&gt;]</code>, but this is coming from a helper functions that
take <code>&amp;Vec&lt;Vec&lt;T&gt;&gt;</code> instead. And… we don't implement <code>Index</code> and <code>IndexMut</code> for
those. Just for the slices. <!-- -->🤯<!-- --> <em>What are we going to do about it?</em></p>
those. Just for the slices. 🤯 <em>What are we going to do about it?</em></p>
<p>We can either start copy-pasting or be smarter about it… I choose to be smarter,
so let's implement a macro! The only difference across the implementations are
the types of the outer containers. Implementation doesn't differ <strong>at all</strong>!</p>
@ -1217,7 +1217,7 @@ Find how many overlap and can take the day off.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="day-5-supply-stacks"><a href="https://adventofcode.com/2022/day/5" target="_blank" rel="noopener noreferrer">Day 5: Supply Stacks</a><a href="https://blog.mfocko.xyz/blog/aoc-2022/1st-week#day-5-supply-stacks" class="hash-link" aria-label="Direct link to day-5-supply-stacks" title="Direct link to day-5-supply-stacks"></a></h2>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>tl;dr</div><div class="admonitionContent_BuS1"><p>Let's play with stacks of crates.</p></div></div>
<p>Very easy problem with very annoying input. You can judge yourself:</p>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3 </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Good luck transforming that into something reasonable :)</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Fun fact</div><div class="admonitionContent_BuS1"><p>Took me 40 minutes to parse this reasonably, including fighting the compiler.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="solution-4">Solution<a href="https://blog.mfocko.xyz/blog/aoc-2022/1st-week#solution-4" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution"></a></h3>

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
@ -35,7 +35,7 @@ order and return the resulting matrix.</p>
<p><img loading="lazy" src="https://assets.leetcode.com/uploads/2020/01/21/1482_example_1_2.png" alt="Image describing the problem" class="img_ev3q"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="skeleton-and-initial-adjustments">Skeleton and initial adjustments<a href="#skeleton-and-initial-adjustments" class="hash-link" aria-label="Direct link to Skeleton and initial adjustments" title="Direct link to Skeleton and initial adjustments"></a></h2>
<p>We are given the following skeleton for the C++ and the given challenge:</p>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>The task is to sort the passed matrix diagonally and then return it. First of all,
I don&#x27;t like to solve this in a web browser, so we&#x27;ll need to adjust it accordingly
for running it locally. We&#x27;ll start by including the <code>vector</code> header and using

View file

@ -314,7 +314,7 @@ everything:</p>
<p>You can also see that it simplifies the meaning a bit and it is more explicit than
the previous versions.</p>
<p>And for the tests:</p>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-diff codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-diff codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_from() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(from_snafu(s), *n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(s.parse::&lt;SNAFU&gt;().unwrap().value, n);</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> #[test]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> fn test_to() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- for (n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">- assert_eq!(to_snafu(*n), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ for (&amp;n, s) in EXAMPLES.iter() {</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">+ assert_eq!(SNAFU::from(n).to_string(), s.to_string());</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> }</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="summary">Summary<a href="https://blog.mfocko.xyz/blog/aoc-2022/4th-week#summary" class="hash-link" aria-label="Direct link to Summary" title="Direct link to Summary"></a></h2>
<p>Let's wrap the whole thing up! Keeping in mind both AoC and the Rust…</p>
<p><img loading="lazy" alt="Finished advent calendar :smile:" src="https://blog.mfocko.xyz/assets/images/calendar-f891b624f3e0efb34bba582100a7d8df.png" width="2417" height="1984" class="img_ev3q"></p>
@ -580,7 +580,7 @@ order and return the resulting matrix.</p>
<p><img loading="lazy" src="https://assets.leetcode.com/uploads/2020/01/21/1482_example_1_2.png" alt="Image describing the problem" class="img_ev3q"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="skeleton-and-initial-adjustments">Skeleton and initial adjustments<a href="https://blog.mfocko.xyz/blog/leetcode/sort-diagonally#skeleton-and-initial-adjustments" class="hash-link" aria-label="Direct link to Skeleton and initial adjustments" title="Direct link to Skeleton and initial adjustments"></a></h2>
<p>We are given the following skeleton for the C++ and the given challenge:</p>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-cpp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-cpp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">Solution</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token operator" style="color:#393A34">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">diagonalSort</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token plain">vector</span><span class="token operator" style="color:#393A34">&lt;</span><span class="token keyword" style="color:#00009f">int</span><span class="token operator" style="color:#393A34">&gt;&gt;</span><span class="token operator" style="color:#393A34">&amp;</span><span class="token plain"> mat</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>The task is to sort the passed matrix diagonally and then return it. First of all,
I don't like to solve this in a web browser, so we'll need to adjust it accordingly
for running it locally. We'll start by including the <code>vector</code> header and using
@ -1063,7 +1063,7 @@ right? Yes… but actually no <!-- -->😦</p>
the fun part consists of the fact that in other place, where we were using it,
we were passing the <code>&amp;[Vec&lt;T&gt;]</code>, but this is coming from a helper functions that
take <code>&amp;Vec&lt;Vec&lt;T&gt;&gt;</code> instead. And… we don't implement <code>Index</code> and <code>IndexMut</code> for
those. Just for the slices. <!-- -->🤯<!-- --> <em>What are we going to do about it?</em></p>
those. Just for the slices. 🤯 <em>What are we going to do about it?</em></p>
<p>We can either start copy-pasting or be smarter about it… I choose to be smarter,
so let's implement a macro! The only difference across the implementations are
the types of the outer containers. Implementation doesn't differ <strong>at all</strong>!</p>
@ -1198,7 +1198,7 @@ Find how many overlap and can take the day off.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="day-5-supply-stacks"><a href="https://adventofcode.com/2022/day/5" target="_blank" rel="noopener noreferrer">Day 5: Supply Stacks</a><a href="https://blog.mfocko.xyz/blog/aoc-2022/1st-week#day-5-supply-stacks" class="hash-link" aria-label="Direct link to day-5-supply-stacks" title="Direct link to day-5-supply-stacks"></a></h2>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>tl;dr</div><div class="admonitionContent_BuS1"><p>Let's play with stacks of crates.</p></div></div>
<p>Very easy problem with very annoying input. You can judge yourself:</p>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C] </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3 </span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"> [D]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[N] [C]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">[Z] [M] [P]</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain"> 1 2 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 3 from 1 to 3</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 2 from 2 to 1</span><br></span><span class="token-line" style="color:#393A34"><span class="token plain">move 1 from 1 to 2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p>Good luck transforming that into something reasonable :)</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Fun fact</div><div class="admonitionContent_BuS1"><p>Took me 40 minutes to parse this reasonably, including fighting the compiler.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="solution-4">Solution<a href="https://blog.mfocko.xyz/blog/aoc-2022/1st-week#solution-4" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution"></a></h3>

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View file

@ -14,7 +14,7 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css" integrity="sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.e1ac7597.css">
<script src="/assets/js/runtime~main.65095f6f.js" defer="defer"></script>
<script src="/assets/js/runtime~main.3f39a938.js" defer="defer"></script>
<script src="/assets/js/main.2a166133.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

Some files were not shown because too many files have changed in this diff Show more