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!
How Mimino tackled the Project Euler challenges
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:
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.
“It’s a great idea and an awesome event, hope you get through all of them :)”
– 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, evidenced 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:
Post-event Q&A with Mimino
Mimino, how do you feel after coding live for 24 hours straight?!
I feel awesome! During those 24 hours I 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 much more pressure. But then, when he said that the event like this is a great idea, it gave me a boost for the next couple of hours. It was great to see the best of the best to stop by and cheer for me.
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 the event?
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.
Mimino’s key takeaways from the Project Euler challenges
After nearly 24 hours of challenges, Mimino walked away with invaluable insight on how to best tackle the Project Euler challenges. We asked him for his 3 key tips and tricks that helped him get through the event. These are his suggestions for any developers looking to attempt the same feat:
Choose the right programming language for the right problem
If you’re looking to practice, he suggests the challenges below:
- 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
Look for patterns in the answers, and then exploit them
Seeking patterns in answers you encounter can help to simplify the process.
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 answers locally: Challenge 12 | Challenge 30 | Challenge 32 | Challenge 33
- Precompute answers before solving the individual test cases: Challenge 10