ConnorRigby

ConnorRigby

Nerves Core Team

Did I cheat at Advent of Code?

SPOILERS AHEAD DON’T CONTINUE IF YOU PLAN ON DOING THE CHALLENGE

I always start Advent of Code, then forget about half way through the month. I really hope to finish this year, but i think i cheated on part two of December 2.

The challenge is to compare strings and find the one that has but one letter change between strings.

here is what i came up with.
Basically it boils down to:

case String.myers_difference(string, check) do
      [eq: pt1, del: <<_>>, ins: <<_>>, eq: pt2] -> pt1 <> pt2 #  the answer.
      _ -> false # move on to the next one.
end

I haven’t looked at anyone else’s implementation of this one yet, but i know this isn’t the intended method of solving this. It got me thinking though: does anyone else try to solve these questions in “illegal” ways?

Most Liked

sasajuric

sasajuric

Author of Elixir In Action

I wouldn’t say that there is such thing as cheating in AoC. For me, these puzzles are about the goals you set for yourself. Many people just like to solve them for fun, and reach for whichever improvisation can help them. For example, one friend solved a puzzle last year on a piece of paper, and a few others by using grep from command line :slight_smile:

When I did AoC last year, my main goal was to practice streams. I also tried to reach the solutions I’m happy with. In some cases, even after solving the challenge, I’d spend a few more sessions (sometimes even spread over a few days) to improve the solution.

So in my view, you set your own rules, and decide when you’re happy with your solution.

yawaramin

yawaramin

You mean did we take full advantage of the language syntax and semantics? Yup! :slight_smile: I did something similar to you, see my post for more details: Advent Of Code 2018 - #19

dbern

dbern

I was comparing with a JavaScript developer’s solution, and ya… Elixir is really nice :slight_smile: I don’t feel like I cheated, but I definitely felt like I had it easier.

Where Next?

Popular in Discussions Top

100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
jeramyRR
This is an interesting article to read. Elixir’s performance, like usual, is excellent. However, it seems like the high CPU usage is co...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
IVR
Hi all, I’ve seen a number of related threads in the past, but I’d still be very curious to hear an up-to-date opinion on this topic. I...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New
RudManusachi
What configs will make sense to put to runtime.exs? – A bit of how I configure apps: I have generic configs in config/config.exs, dev...
New
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New

Other popular topics Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52774 488
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

We're in Beta

About us Mission Statement