<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: E. Choroba</title>
    <description>The latest articles on DEV Community by E. Choroba (@choroba).</description>
    <link>https://dev.to/choroba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F57650%2Fba1f03a9-a1ea-444b-8296-1422f5f0c624.jpeg</url>
      <title>DEV Community: E. Choroba</title>
      <link>https://dev.to/choroba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/choroba"/>
    <language>en</language>
    <item>
      <title>My Solutions to Advent of Code 2019</title>
      <dc:creator>E. Choroba</dc:creator>
      <pubDate>Fri, 27 Dec 2019 20:38:52 +0000</pubDate>
      <link>https://dev.to/choroba/my-solutions-to-advent-of-code-2019-4eo7</link>
      <guid>https://dev.to/choroba/my-solutions-to-advent-of-code-2019-4eo7</guid>
      <description>&lt;p&gt;This year again, I decided to solve the Advent of Code. All my solutions are now public at &lt;a href="https://github.com/choroba/aoc19" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. I used Perl, my native programming language, but hopefully I managed to stay on the readable side.&lt;/p&gt;

&lt;p&gt;My solution for &lt;a href="https://adventofcode.com/2019/day/18" rel="noopener noreferrer"&gt;day 18 part 2&lt;/a&gt; was accepted, but the program didn't work for one of the examples mentioned in the description, so it's definitely buggy.&lt;/p&gt;

&lt;p&gt;To solve &lt;a href="https://adventofcode.com/2019/day/22" rel="noopener noreferrer"&gt;day 22 part 2&lt;/a&gt;, I first needed to understand a Java solution posted on Reddit, otherwise I would have stayed clueless.&lt;/p&gt;

&lt;p&gt;Living in the Central Europe, I haven't managed to get up early enough to get into the main leaderboard. On the other hand, only two solutions (part 2 of days 20 and 24) were submitted more than 24 hours after the publication time.&lt;/p&gt;

&lt;p&gt;I enjoyed all the assignments and loved to participate. Having spent hours with some of the solutions, I still can't imagine what kind of graft it must be to prepare the competition. Big thanks to the &lt;a href="http://was.tl" rel="noopener noreferrer"&gt;organiser&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>adventofcode</category>
      <category>perl</category>
    </item>
    <item>
      <title>DEV.to not working in Firefox</title>
      <dc:creator>E. Choroba</dc:creator>
      <pubDate>Sat, 08 Jun 2019 18:19:58 +0000</pubDate>
      <link>https://dev.to/choroba/dev-to-not-working-in-firefox-592</link>
      <guid>https://dev.to/choroba/dev-to-not-working-in-firefox-592</guid>
      <description>&lt;p&gt;Dev.to stopped working for me in Firefox (yes, that's my default browser). Only the top article in the feed is displayed. My avatar is not shown, my tags aren't loaded... It started when there were the problems with Firefox extensions, but I don't use many of them and I doubt dev.to depends on any of them.&lt;/p&gt;

&lt;p&gt;It works fine in Chromium or Opera. Does it work for you? Any ideas what I should do to fix it?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Omn9Yhj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/i6fqpe5exmvo39grqgmz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Omn9Yhj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/i6fqpe5exmvo39grqgmz.png" alt="Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devto</category>
    </item>
    <item>
      <title>Google Code Jam 2019 Qualification</title>
      <dc:creator>E. Choroba</dc:creator>
      <pubDate>Fri, 12 Apr 2019 22:04:28 +0000</pubDate>
      <link>https://dev.to/choroba/google-code-jam-2019-qualification-19jd</link>
      <guid>https://dev.to/choroba/google-code-jam-2019-qualification-19jd</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq4hbqef1fbwsizcloc0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjq4hbqef1fbwsizcloc0.jpg" alt="jam" width="350" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This year's Google Code Jam Qualification round limit was 30 points. Solving just the two simpler tasks yielded enough to get you through.&lt;/p&gt;

&lt;p&gt;I used Perl to solve the problems, as it's the language I can write the fastest.&lt;/p&gt;

&lt;p&gt;You can find the problems in the &lt;a href="https://codingcompetitions.withgoogle.com/codejam/archive/2019" rel="noopener noreferrer"&gt;Archive&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  First task
&lt;/h2&gt;

&lt;p&gt;The first task sounded easy: the input is a sequence of numbers each containing the digit 4. For each number N, output two numbers A and B such that N = A + B and neither A nor B contains the digit 4.&lt;/p&gt;

&lt;p&gt;I used the &lt;a href="http://p3rl.org/tr" rel="noopener noreferrer"&gt;tr&lt;/a&gt; operator (similar to the &lt;code&gt;tr&lt;/code&gt; utility you might know from *nix) to replace all 4's by 3's. That was my A. To get the B, I just subtracted A from the original N.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight perl"&gt;&lt;code&gt;&lt;span class="c1"&gt;#! /usr/bin/perl&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;warnings&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;strict&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;feature&lt;/span&gt; &lt;span class="sx"&gt;qw{ say }&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;chomp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$cases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$case&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;..&lt;/span&gt; &lt;span class="nv"&gt;$cases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;chomp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="sr"&gt;tr/4/3/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;say&lt;/span&gt; &lt;span class="p"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Case #&lt;/span&gt;&lt;span class="si"&gt;$case&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="si"&gt;$j&lt;/span&gt;&lt;span class="p"&gt;";&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gave me the first 16 points. To get one more, it was needed to handle much larger numbers. It's possible by using the &lt;a href="http://p3rl.org/Math::BigInt" rel="noopener noreferrer"&gt;Math::BigInt&lt;/a&gt; core module, but I rather rushed to the next task.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight perl"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;Math::&lt;/span&gt;&lt;span class="nv"&gt;BigInt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$j&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Math::BigInt&lt;/span&gt;&lt;span class="p"&gt;'&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Math::BigInt&lt;/span&gt;&lt;span class="p"&gt;'&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Second task
&lt;/h2&gt;

&lt;p&gt;You were given a path in a square where each step goes either to the south or to the east. You need to find a different path that starts and ends in the same places (which are the nortwest and southeast corners), but never reuses the given path.&lt;/p&gt;

&lt;p&gt;The input path is encoded as a string like &lt;code&gt;SSEEESSE&lt;/code&gt;. Surprisingly, the transliteration operator can again provide a short and straightforward solution. It corresponds to the path that's line symmetric with the input where the axis connects the start and end points.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight perl"&gt;&lt;code&gt;&lt;span class="c1"&gt;#! /usr/bin/perl&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;warnings&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;strict&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nv"&gt;feature&lt;/span&gt; &lt;span class="sx"&gt;qw{ say }&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;chomp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$cases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$case&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;..&lt;/span&gt; &lt;span class="nv"&gt;$cases&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;chomp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$lydia_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$lydia_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="sr"&gt;tr/SE/ES/&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;say&lt;/span&gt; &lt;span class="p"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Case #&lt;/span&gt;&lt;span class="si"&gt;$case&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;$path&lt;/span&gt;&lt;span class="p"&gt;";&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gave me 14 points, so my advancement was secured.&lt;/p&gt;

&lt;p&gt;I also solved the third task, but the solution was ugly and didn't work for the larger inputs and extra points. It gave me 10 more points.&lt;/p&gt;

&lt;p&gt;See you in the Round 1!&lt;/p&gt;

</description>
      <category>challenge</category>
      <category>competition</category>
      <category>perl</category>
      <category>codejam</category>
    </item>
    <item>
      <title>AoC Day 8: Memory Maneuver</title>
      <dc:creator>E. Choroba</dc:creator>
      <pubDate>Sat, 08 Dec 2018 08:21:04 +0000</pubDate>
      <link>https://dev.to/choroba/aoc-day-8-memory-maneuver-1f93</link>
      <guid>https://dev.to/choroba/aoc-day-8-memory-maneuver-1f93</guid>
      <description>&lt;p&gt;&lt;a href="https://adventofcode.com/2018/day/8" rel="noopener noreferrer"&gt;Day 8&lt;/a&gt;!&lt;br&gt;
Today's tasks felt much easier than yesterday's, but maybe it was because they were closer to what I used to do at $job - 2.&lt;/p&gt;

&lt;p&gt;Let's recursively parse a tree from a sequence of integers! Meaning of each number depends on its position in the sequence and on the meaning of the other numbers...&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>adventofcode</category>
    </item>
  </channel>
</rss>
