feat(cses): more problems

This commit is contained in:
Barrett Ruth 2025-02-23 18:41:56 -05:00
parent cd30fa3ea8
commit 1c1346689e
2 changed files with 103 additions and 91 deletions

View file

@ -191,97 +191,108 @@
Everyone recommends CSES so I started with it, doing the first 8 Everyone recommends CSES so I started with it, doing the first 8
problems. problems.
</p> </p>
<h3> <ul>
<li>
<a href="https://cses.fi/problemset/task/1068" target="_blank" <a href="https://cses.fi/problemset/task/1068" target="_blank"
>weird algorithm</a >weird algorithm</a
> >: Trivial, but I forgot to print 1 at the end.
</h3>
<p>Trivial, but I forgot to print 1 at the end.</p>
<p>
<b>Return the exactly correct answer.</b> <b>Return the exactly correct answer.</b>
</p> </li>
<h3> <li>
<a href="https://cses.fi/problemset/task/1083" target="_blank"> <a href="https://cses.fi/problemset/task/1083" target="_blank">
missing number missing number </a
</a> >: N/A
</h3> </li>
<p>N/A</p> <li>
<h3>
<a href="https://cses.fi/problemset/task/1069" target="_blank"> <a href="https://cses.fi/problemset/task/1069" target="_blank">
repetitions repetitions </a
</a> >: Use invariants.
</h3> </li>
<p>Use invariants.</p> <li>
<h3>
<a href="https://cses.fi/problemset/task/1094" target="_blank"> <a href="https://cses.fi/problemset/task/1094" target="_blank">
increasing array increasing array </a
</a> >: Run through one iteration of the algorithm. Here, I erroneously
</h3>
<p>
Run through one iteration of the algorithm. Here, I erroneously
added <code>x - last</code> to a quantity, added <code>x - last</code> to a quantity,
<i>after manipulating <code>x</code></i <i>after manipulating <code>x</code></i
>. >.
</p> </li>
<h3> <li>
<a href="https://cses.fi/problemset/task/1070/" target="_blank" <a href="https://cses.fi/problemset/task/1070/" target="_blank"
>permutations</a >permutations</a
> >: I'd seen this problem before yet struggled.
</h3> <b>Fully understand the problem constraints</b>. In this case,
<p> While I understood the definition of a permissible permutation, I
I'd seen this problem before yet struggled. didn't fully internalize that you could place number
<b>Fully understand the problem constraints</b>. In this case, While <i>wherever</i> you want. Instead, I was locked in on placing some
I understood the definition of a permissible permutation, I didn't <code>x</code> at <code>i, i + 2, i + 4, ...</code>. Further, the
fully internalize that you could place number <i>wherever</i> you fact that I didn't immediately recognize this solution means I
want. Instead, I was locked in on placing some <code>x</code> at need to improve at <b>upsolving and reviewing problems</b>.
<code>i, i + 2, i + 4, ...</code>. Further, the fact that I didn't </li>
immediately recognize this solution means I need to improve at <li>
<b>upsolving and reviewing problems</b>.
</p>
<h3>
<a href="https://cses.fi/problemset/task/1071" target="_blank" <a href="https://cses.fi/problemset/task/1071" target="_blank"
>permutations</a >permutations</a
> >: Absolutely disastrous. I continually just f*dged with the
</h3> offsets I was adding to my strategy until I happened to get the
<p> answer right. <b>Don't guess</b>. Also,
Absolutely disastrous. I continually just f*dged with the offsets I
was adding to my strategy until I happened to get the answer right.
<b>Don't guess</b>. Also,
<b <b
>don't be lazy&mdash;if an algorithm works, focus, write it out, >don't be lazy&mdash;if an algorithm works, focus, write it out,
and enjoy being correct</b and enjoy being correct</b
>. >.
</p> </li>
<h3> <li>
<a href="https://cses.fi/problemset/task/1072" target="_blank" <a href="https://cses.fi/problemset/task/1072" target="_blank"
>two knights</a >two knights</a
> >: Required 2 hints from Sam Altman.
</h3> <b>git gud at combinatorics</b>. Use the paradigm "count good,
<p> remove bad." Lock in less on counting specifics&mdash;instead,
Required 2 hints from Sam Altman. <b>git gud at combinatorics</b>. consider what objects <i>mean in aggregate</i>. In this case, a
Use the paradigm "count good, remove bad." Lock in less on counting \(2\times3\) grid represents an "area" of attack, contributing 2
specifics&mdash;instead, consider what objects bad knight pairs. This is much easier to digest then attempting to
<i>mean in aggregate</i>. In this case, a \(2\times3\) grid remove overcounting per-knight. Fundamentally, the problem
represents an "area" of attack, contributing 2 bad knight pairs. involves placing 2 knights, so breaking it down 2 knights at a
This is much easier to digest then attempting to remove overcounting time is the most intuitive take.
per-knight. Fundamentally, the problem involves placing 2 knights, </li>
so breaking it down 2 knights at a time is the most intuitive take. <li>
</p>
<h3>
<a href="https://cses.fi/problemset/task/1092" target="_blank" <a href="https://cses.fi/problemset/task/1092" target="_blank"
>two sets</a >two sets</a
> >: <b>Don't lock in on one approach</b>. Here, this is dp. The
</h3> fact that I knew the idea of partitioning the first \(n\) numbers
<p> into two groups of size \(\frac{n(n+1)}{4}\) but failed to
<b>Don't lock in on one approach</b>. Here, this is dp. The fact recognize the greedy approach means I didn't grasp the fundamental
that I knew the idea of partitioning the first \(n\) numbers into arithmetic of the problem, nor the greedy idea: every number must
two groups of size \(\frac{n(n+1)}{4}\) but failed to recognize the go into a set. If you add the largest number possible to set 1 to
greedy approach means I didn't grasp the fundamental arithmetic of not exceed the target, this number can always be formed in the
the problem, nor the greedy idea: every number must go into a set. other set by choosing \(1\) and \(x-1\). <b>git gud at greedy</b>.
If you add the largest number possible to set 1 to not exceed the </li>
target, this number can always be formed in the other set by </ul>
choosing \(1\) and \(x-1\). <b>git gud at greedy</b>. <h2>more cses&mdash;22/2/2025</h2>
</p> <ul>
<li>
<a href="https://cses.fi/problemset/task/2205" target="_blank"
>gray code</a
>: Missed the pattern + <b>gave up too <i>late</i></b>
</li>
<li>
<a href="https://cses.fi/problemset/task/2165" target="_blank"
>towers of hanoi</a
>: <b>Recursive grasp is limp</b>&mdash;missed the idea.
<b>Math/proof grasp too</b>&mdash;still don't understand how its
\(2^n\).
</li>
<li>
<a href="https://cses.fi/problemset/task/1623" target="_blank"
>apple division</a
>: I got distracted by the idea that it was NP-hard. Even when Sam
Altman told me it was DP, I failed to simplify it to "add every
element either to one or the other set".
</li>
<li>
<a href="https://cses.fi/problemset/task/2431">digit queries</a>:
got the idea + time complexity quickly, but the
<b>math-based implementation is weak</b>. Jumped into the code
<i>before</i> outlining a strict plan.
</li>
</ul>
</article> </article>
</div> </div>
</main> </main>

View file

@ -15,6 +15,7 @@ header {
ul { ul {
list-style: unset; list-style: unset;
list-style-type: "- ";
} }
li { li {