Top
Best
New

Posted by swatson741 20 hours ago

Project Euler(projecteuler.net)
467 points | 120 commentspage 6
nurettin 17 hours ago|
2007 I remember writing one-liner ruby solutions up to 100.
sbmthakur 18 hours ago||
Hackerrank also used to host(still has?) PE problems with additional test cases.
graycat 19 hours ago||
Glanced at the exercises. It appears that two of them have numbers arranged in a triangle and ask for a longest path.

Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x. For the resulting triangle, solve it to give the shortest path using one of the well known network shortest path algorithms.

n4r9 6 hours ago||
The "well known" path algorithms in this case are overkill; the graph is a tree. And Dijkstra is not really designed to handle negative edge weights (although it would probably function correctly in this instance).
thaumasiotes 15 hours ago||
> Hmm. Given such a triangle, let m be the largest number in the triangle. For each x in the triangle, replace it with m - x.

By the time you've actually done these two steps, you could have already finished the problem with a dynamic programming approach.

(Starting from the bottom row and working upward, replace each cell in the row with the length of the longest path from itself to the bottom, which you can know by checking which of its two children has the longer path associated.)

ssalmon74 20 hours ago||
[flagged]
treve 19 hours ago||
Nobody is interested in AI commentary.
vntok 14 hours ago||
That seems incorrect. This sub-thread is the longest already in this submission, and no other commenter remarked about the parent commenter being an AI.
rhdunn 19 hours ago|||
I've personally found the opposite. In order to advance you need to know the specific techniques or mathematics and there are no hints or information on how to approach the problem. So it boils down to how much of that mathematics you know. If you don't then the brute force approaches take a long time to find the solution.
btilly 19 hours ago|||
I disagree.

Often the techniques that you need for a harder problem, are discussed in a forum for an easier problem. Even more often the techniques that you need for a given problem are possible to work out from scratch. And the more you work out, the easier they get.

This can be very frustrating for people who are used to being spoon fed techniques, then given problems which use what they have just been taught. But it is a lot of fun for people who enjoy puzzles. If it isn't your cup of tea, that's fine. But don't dismiss it for people who enjoy it.

Disclaimer. I haven't personally engaged in the last few years, but I've spent a lot of time on it. I solved 598 and contributed a couple of puzzles as well. One of which they immediately saw a way to do that I hadn't, and put it out there with a difficulty level that I didn't know how to do! That was https://projecteuler.net/problem=240.

zelphirkalt 4 hours ago||
Wait, the math is discussed only in the forums? I thought one is supposed to gain mathematical insight from solving alone. As far as I have read here, forums are only accessible when having an account, which I don't. That would mean to solve later puzzles, I would need an account most likely.
leosanchez 19 hours ago|||
I think with a few math tricks you can solve around 25-50, It gets very tough after that without maths background.
rhdunn 18 hours ago||
Yeah. I think I got to around 10-15 before I got stuck. It's been several years since I attempted it though.
josh-stylo 19 hours ago||
Completely agree! Google + Project Euler was how I learned to code
fortranfiend 15 hours ago||
fake frustration yet another thing named after euler.