<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="379277" data-post-id="379277">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bjorng" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bjorng/120/13187_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bjorng
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Erlang Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Started with brute force. Added memoization when part 2 didn’t finish.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Day03 do
  def part1(input) do
    solve(input, 2)
  end

  def part2(input) do
    solve(input, 12)
  end

  defp solve(input, num_batteries) do
    parse(input)
    |&gt; Enum.map(fn bank -&gt;
      power = Integer.pow(10, num_batteries-1)
      {result, _} = find_max(bank, power, %{})
      result
    end)
    |&gt; Enum.sum
  end

  defp find_max(_, 0, memo), do: {0, memo}
  defp find_max([], _mul, memo), do: {-10_000_000_000_000, memo}
  defp find_max([j | rest], mul, memo) do
    {amount1, memo} = memo_find_max(rest, div(mul, 10), memo)
    amount1 = j * mul + amount1
    {amount2, memo} = memo_find_max(rest, mul, memo)
    {max(amount1, amount2), memo}
  end

  defp memo_find_max(rest, mul, memo) do
    key = {mul,rest}
    case memo do
      %{^key =&gt; result} -&gt;
        {result, memo}
      %{} -&gt;
        {result, memo} = find_max(rest, mul, memo)
        memo = Map.put(memo, key, result)
        {result, memo}
    end
  end

  defp parse(input) do
    input
    |&gt; Enum.map(fn line -&gt;
      String.to_charlist(line)
      |&gt; Enum.map(&amp;(&amp;1 - ?0))
    end)
  end
end

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379277" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-379277" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379277"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="379300" data-post-id="379300">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dompdv" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dompdv/120/36848_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dompdv
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’d be happy to have a commented code. Your solution looks impressive but I don’t understand at all how it works! Is it a tree search with memoization ?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379300" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-379300" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379300"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="379302" data-post-id="379302">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dompdv" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dompdv/120/36848_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dompdv
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>My solution, after a first attempt doing a never ending search (I’ve forgotten about memoization: I should memorize memoization more often). I thought my nice optimizations would do it, but finally they didn’t.<br>
I found a more direct way</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule AdventOfCode.Solution.Year2025.Day03 do
  def parse(input) do
    input
    |&gt; String.split("\n", trim: true)
    |&gt; Enum.map(fn bank -&gt;
      bank |&gt; to_charlist() |&gt; Enum.map(&amp;(&amp;1 - ?0))
    end)
  end

  ### Part 1
  def largest_two(bank) do
    bank_wi = Enum.with_index(bank)
    Enum.max(for {n1, i1} &lt;- bank_wi, {n2, i2} &lt;- bank_wi, i1 &lt; i2, do: n1 * 10 + n2)
  end

  def part1(input), do: parse(input) |&gt; Enum.map(&amp;largest_two/1) |&gt; Enum.sum()

  ### Part 2
  # End of recursion: all switches are activated
  def search(_, cumul, -1), do: cumul

  def search(rest, cumul, n_switches) do
    # Consider the max number on the right (keeping enough numbers for all the switches that are still to activate)
    max_in_remaining = rest |&gt; Enum.slice(0..(length(rest) - n_switches - 1)) |&gt; Enum.max()
    # Drop the numbers to the right until (and including) this max
    {_, [_max_in_remaining | r]} = Enum.split_while(rest, &amp;(&amp;1 != max_in_remaining))
    # Loop recursively
    search(r, cumul + max_in_remaining * Integer.pow(10, n_switches), n_switches - 1)
  end

  def part2(input), do: parse(input) |&gt; Enum.map(&amp;search(&amp;1, 0, 11)) |&gt; Enum.sum()
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379302" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-379302" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379302"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="379303" data-post-id="379303">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="BartOtten" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/BartOtten/120/25440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  BartOtten
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Here we go.</p>
<p><strong>Who knows?</strong><br>
How to do a ‘selective capture’?</p>
<p>The reducer passes 2 arguments to the anonymous function. Thought I could simply do <code>(&amp;2)</code> but that is not allowed. <code>&amp;1</code> has to be used. The dirty trick is to <code>(&amp;2 || &amp;1)</code> when you are certain &amp;2 will never be falsy but it is stretching the limits.</p>
<p>Could have gone with a simple <code>fn</code> but am wondering if someone knows a nice solid trick.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Aoc2025.Solutions.Y25.Day03 do
  alias AoC.Input

  def parse(input, _part) do
    Input.read!(input)
    |&gt; String.trim()
    |&gt; String.split("\n")
    |&gt; Enum.map(&amp;String.to_charlist/1)
  end

  def part_one(problem) do
    solve(problem, 2)
  end

  def part_two(problem) do
    solve(problem, 12)
  end

  def solve(problem, limit) do
    problem
    |&gt; Stream.map(&amp;keep_highest(&amp;1, limit))
    |&gt; Stream.map(&amp;to_string/1)
    |&gt; Stream.map(&amp;String.to_integer/1)
    |&gt; Enum.sum()
  end

  def keep_highest(bank, limit) do
      discard = length(bank) - limit
      Enum.reduce(1..discard, bank, &amp;maximize/2)
  end

  def maximize(_reduction, bank), do: maximize(bank)
  def maximize([x, s]), do: [max(x, s)]
  def maximize([l, r | rest]) when l &lt; r, do: [r | rest]
  def maximize([l, r | rest]), do: [l | maximize([r | rest])]
end
</code></pre>
<p>Edit 1: You can play “spot the differences” with <a class="mention" href="/u/hauleth" rel="nofollow">@hauleth</a> <a href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/7" rel="nofollow">solution</a> <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379303" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-379303" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379303"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="379315" data-post-id="379315">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Aetherus" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Aetherus/120/17203_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Aetherus
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, it is memoization. I don’t know what your definition of tree search is though, cuz there’s no tree in my implementation.</p>
<p>My <code>memo</code> stores the tuple <code>{lights_need_to_turn_on, index}</code> as the keys, and <code>max_jolt_in_the_subarray_from_index_and_after</code> as the values.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379315" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-379315" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379315"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="379350" data-post-id="379350">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lkuty" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lkuty/120/34879_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lkuty
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<pre data-code-wrap="elixir"><code class="lang-elixir">#!/usr/bin/env elixir

# Advent of Code 2025. Day 3

defmodule M do
  def largest_joltage_2(bank) do
    bank
    |&gt; String.codepoints()
    |&gt; Enum.map(&amp;String.to_integer/1)
    |&gt; Enum.reduce({nil, nil}, fn
      d, {nil, nil} -&gt; {d, nil}
      d, {d1, nil} -&gt; {d1, d}
      d, {d1, d2} when d1*10+d &gt; d1*10+d2 and d1*10+d &gt; d2*10+d -&gt; {d1, d}
      d, {d1, d2} when d2*10+d &gt; d1*10+d2 -&gt; {d2, d}
      _d, {d1, d2} -&gt; {d1, d2}
    end)
    |&gt; then(fn {d1, d2} -&gt; d1*10+d2 end)
  end

  def largest_joltage_12(bank) do
    bank
    |&gt; String.codepoints()
    |&gt; Enum.map(&amp;String.to_integer/1)
    |&gt; Enum.reduce([], fn
      d, lst when length(lst) &lt; 12 -&gt; [d | lst]
      d, lst -&gt; max_list(d, lst)
    end)
    |&gt; lst_to_num()
  end

  defp max_list(d, lst) do
    Enum.max_by([
      lst,
      [d | List.delete_at(lst, 0)],
      [d | List.delete_at(lst, 1)],
      [d | List.delete_at(lst, 2)],
      [d | List.delete_at(lst, 3)],
      [d | List.delete_at(lst, 4)],
      [d | List.delete_at(lst, 5)],
      [d | List.delete_at(lst, 6)],
      [d | List.delete_at(lst, 7)],
      [d | List.delete_at(lst, 8)],
      [d | List.delete_at(lst, 9)],
      [d | List.delete_at(lst, 10)],
      [d | List.delete_at(lst, 11)],
    ], &amp;lst_to_num/1)
  end
  defp lst_to_num(lst), do: lst |&gt; Enum.reverse() |&gt; Enum.reduce(0, fn d, total -&gt; total*10+d end)
end

# Part 1
File.read!("../day03.txt")
|&gt; String.split()
|&gt; Enum.map(&amp;M.largest_joltage_2/1)
|&gt; Enum.sum()
|&gt; IO.inspect(label: "Day 3. Part 1")

# Part 2
File.read!("../day03.txt")
|&gt; String.split()
|&gt; Enum.map(&amp;M.largest_joltage_12/1)
|&gt; Enum.sum()
|&gt; IO.inspect(label: "Day 3. Part 2")
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379350" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-379350" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379350"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="379353" data-post-id="379353">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lkuty" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lkuty/120/34879_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lkuty
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ooops forgot about <code>Integer.undigits/2</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379353" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-379353" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379353"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="379624" data-post-id="379624">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="adamu" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/adamu/120/31482_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  adamu
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is really nice. I also today TIL learned <code>Integer.undigits/2</code>, although replacing a string round-trip with that didn’t make my solution faster <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379624" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-379624" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379624"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="379627" data-post-id="379627">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="brownerd" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/brownerd/120/27931_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  brownerd
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Day03 do
  @spec part_one(String.t()) :: non_neg_integer
  def part_one("priv/" &lt;&gt; _rest_of_path = path_to_data) do
    path_to_data
    |&gt; stream_input()
    |&gt; Enum.map(&amp;take_n_max_batteries_from_bank_in_order(&amp;1, 2))
    |&gt; Enum.reduce(0, fn number_string, acc -&gt; String.to_integer(number_string) + acc end)
  end

  @spec part_two(String.t()) :: non_neg_integer
  def part_two("priv/" &lt;&gt; _rest_of_path = path_to_data) do
    path_to_data
    |&gt; stream_input()
    |&gt; Enum.map(&amp;take_n_max_batteries_from_bank_in_order(&amp;1, 12))
    |&gt; Enum.reduce(0, fn number_string, acc -&gt; String.to_integer(number_string) + acc end)
  end

  def take_n_max_batteries_from_bank_in_order(line, take), do: do_find(line, take)

  defp do_find(line, take) do
    &lt;&lt;bank::binary-size(byte_size(line) - take + 1), buffer::binary&gt;&gt; = line
    do_find(bank, buffer, take)
  end

  @reset ""

  defp do_find(bank, buffer, take, rest \\ "", max \\ "", collected \\ "")
  defp do_find(_, _, take, _, _, collected) when byte_size(collected) == take, do: collected
  defp do_find(&lt;&lt;b&gt;&gt; &lt;&gt; bank, buffer, take, max, _rest, collected) when &lt;&lt;b&gt;&gt; &gt; max, 
	  do: do_find(bank, buffer, take, &lt;&lt;b&gt;&gt;, @reset, collected)
  defp do_find(&lt;&lt;b&gt;&gt; &lt;&gt; bank, buffer, take, max, rest, collected), 
	  do: do_find(bank, buffer, take, max, rest &lt;&gt; &lt;&lt;b&gt;&gt;, collected)
  defp do_find("", "", take, max, seen, collected), 
	  do: do_find(seen, @reset, take, @reset, @reset, collected &lt;&gt; max)
  defp do_find("", &lt;&lt;b&gt;&gt; &lt;&gt; buffer, take, max, seen, collected), 
	  do: do_find(seen &lt;&gt; &lt;&lt;b&gt;&gt;, buffer, take, @reset, @reset, collected &lt;&gt; max)

  # ------------------------------------------------------------------------------

  defp stream_input(input) do
    input
    |&gt; File.stream!()
    |&gt; Stream.map(&amp;String.trim/1)
  end
end
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379627" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-379627" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379627"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
    <div class="postbit" id="379797" data-post-id="379797">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Gearhartlove" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Gearhartlove/120/40241_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Gearhartlove
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for sharing this solution, it helped me out a ton. I love the <code>Enum.max_by(fn {a, i} -&gt; {a, -i} end)</code> because it’s a great way to select the “left most” maximum. I also didn’t realize that you perform max and min on tuples, great to learn that they compare their values left to right. Thanks again!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="379797" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/advent-of-code-2025-day-3/73527/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-379797" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="379797"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/73527/load_more?page=3">Load more posts (1 remaining)</a>
</div></template></turbo-stream>