How Mimino Solved 78 Project Euler Problems in Under 24 Hours

Last weekend, HackerRank hosted its 1st live streaming event in which Michal Danilak, more famously known as Mimino, achieved a herculean feat. Mimino solved ALL 78 Project Euler challenges in under 24 hours, at a rate of about 18 minutes per problem!

Although C++ is his best language, Mimino used at least 13 languages altogether. In fact, he learned several different languages on the spot, like parts of Bash and PHP. Here’s a breakdown of which languages he used by frequency. The graph doesn’t include Python 2 & 3 as separate languages:

Untitled Infographic

The well over 8,500 passionate folks who tuned into the live stream throughout the 24 hour event were in some grand company. The legendary world’s highest ranked competitive coder Petr Mitrichev joined the live chat to commend Mimino on this awesome undertaking and even guided Mimino through a roadblock! He said: “I’d check for int overflows, your output starts breaking around 2**16.”

Michal Forišek, Gaoyuan Chen, even the problem writers and administrators from Project Euler all joined the lively conversation to offer tips and well wishes to Mimino. The superstar of the day even live chatted with the community directly, answering questions about his approach.

Petr Mitrichev

Watching Mimino tackle all 78 problems was awe-inducing to the say the least. No matter how many times he was stuck, down to the 24th hour, Mimino never seemed too frustrated or even close to giving up. It was the perfect place for a dose of inspiration, evident by some amazing comments from community members:

  • “Mimino doesn’t sleep, he’s the real Batman!” one community member said.
  • “After seeing him code, there’s only one conclusion from it. Nothing is impossible and if you’re truly dedicated to coding. Even time cannot stop you from coding.”
  • “I have only heard about programming prodigies. Today, I’ve seen one. Hats off. Congrats on your achievement!”

We had a chance to catch up with Mimino after the event. Check out what he had to say about the event:

Mimino, how do you feel after coding live for 24 hours straight?!

I feel awesome! During those 24 hours I have received so much positive energy from the people who were watching, chatting and motivating me. It was great to see so many people excited about the competitive programming and problem solving.

How did you feel when some of the world’s greatest coders joined the live chat?

When Petr Mitrichev showed up, I was just struggling to find a nasty integer overflow bug in my code at the time. Right after he joined, he was the first one to discover it and let me know about it, so it really shows who is the best in this game.

But knowing that he is watching me now, I felt under much more pressure. But then, when he said that the event like this is a great idea, it gave me the boost for the next couple of hours. It was great to see the best of the best to stop by and cheer for me.

11166049_10200518079470376_1740731366_n

What impact do you think this feat have on you and the programming field in general?

In the Q&A interview before the event, we were talking about the recognition for top competitive programmers, and I said that the current format of the events doesn’t really support people to have fans.

What I think this event did successfully was to show that there is a big potential in this area. We saw that people can get excited about the competitive programming and competitive programmers. And we also showed that events like this can be not only educational but also entertaining. I do believe that 24-hour programming challenge was in this sense a successful proof of concept and I feel glad that I was part of it.

Some commentators wondered if you are human. What motivated you throughout?

As I have already answered on Quora, every time someone compared me to batman or terminator, I just couldn’t ruin that image by having a rest 🙂

Which were the toughest challenges for you and how did you overcome them?

I think my biggest crisis came around 6 a.m. (21 hours into the challenge) when I opened the problem #64 with continued fractions and then the problem #66 with Diophantine equation, which solution is again based on the continued fractions.

I just couldn’t get my head around how continued fractions work at that hour, so I was just blindly trying to imitate the method shown in the problem statement. My solution was really just “fake it until you make it” type of solution. But then again, I have demonstrated a couple of times during the event that I’m able to solve the problem, even though I have no idea what I’m doing.  😀

Please tell us your top 3 tips & tricks that helped you achieve this feat!

These are the main tricks and takeaways that I demonstrated throughout the event also with the representative problems for each trick:

1. Choose the right programming language for the right problem

– for speed choose C++
Challenge 60
Challenge 68

– for fast big integer arithmetic choose Java
Challenge 48

– for simplicity choose Python
Challenge 34
Challenge 56

2. Look for the patterns in the answers and then exploit them

Challenge 39
Challenge 50

3. Precompute everything you can. This is the biggest speed optimization you can get. Once you have the answers precomputed, outputting them has time complexity O(1)

– precompute the answers locally

Challenge 12
Challenge 30
Challenge 32
Challenge 33

– precompute the answers before solving the individual test cases

Challenge 10

 

If you missed out, don’t worry. Here are the links to the full video!

Part 1 
Part 2
Part 3

 

11 Replies to “How Mimino Solved 78 Project Euler Problems in Under 24 Hours”

  1. I found tips on choosing the right programming language for a certain problem very interesting, could you provide more examples? Like what kind of Project Euler problems are PHP and Ruby better suited for?

Leave a Reply

Your email address will not be published. Required fields are marked *