Live data from Hacker News

Project Euler #912: Where are the Odds?

projecteuler.net

81–90 of 105 posts

Re: Project Euler #912: Where are the Odds?

#81

I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language. I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code p…

Codewars can do this, they keep how problems was solved. If a problem was solved using some string by most answers than it is a good problem to learn that part of the language. With documentation you have really good way to cover all parts of a programming language.

Re: Project Euler #912: Where are the Odds?

#82
post #55

I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language. I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code p…

to be fair, PE is not designed or meant for helping people learn a language. that isn't the project's intent. people do like to say they use PE for learning new languages, but I doubt that is a useful exercise beyond maybe the first dozen problems or so. And even then, if the solution isn't obvious to you, you're doing two things at once - learning a language and solving a math puzzle. I don't see why people would si…

> I don't see why people would sign up to get frustrated like that.

I actually use this as a learning trick. Pick two or three things to learn simultaneously, then when I get stuck on one aspect, switch to another. When I finally switch back, I often find the background time I gave my brain to process the problem means I'll now be much faster to get unstuck on the original issue.

There's definitely ways this can go sideways, and it's not for everybody, but I find it pretty effective.

Re: Project Euler #912: Where are the Odds?

#83

I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language. I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code p…

I really think you'd like these two project pages, they were posted to HN some time ago but the original links have been slain by bitrot.

https://austinhenley.com/blog/challengingprojects.html https://austinhenley.com/blog/morechallengingprojects.html

Re: Project Euler #912: Where are the Odds?

#84
post #74

I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language. I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code p…

If you're trying to model those "puzzlers" on actual dev work, then doing any of those things without a library/framework is a wrong answer. Or is that your point? That coding like a pro means gluing those things together?

A few different things:

1. Yes, solving these puzzles would mean often mean using a library.

2. However, for most of the things I listed above, in most languages, a competent software developer should be able to, and most likely would just use the standard library.

3. Why not both? I can imagine a catalog with thousands of problem sets. Some may challenge you to (re-)implement some existing functionality yourself (as a super basic example, re-implement the java Optional::flatMap method or something). Others could challenge you to make use of existing implementations. Learning to make use of stdlib and other libraries and tools in the ecosystem is part of one's growth, and also so is working through those tools, tinkering, trying to think how you would have implemented them, and getting a better understanding of their internals (or at least, an understanding of how their internals MIGHT work)

Re: Project Euler #912: Where are the Odds?

#85
post #6

Earlier quoted context omitted.

To be honest, I don't see people talking about it that much. But I'm certain that it would appeal to a good chunk of the people here.

But isn’t it mathematical computing? I feel like leetcode DSA is closer to your average HN user

There's certainly a strong element of computational mathematics. A lot of the problems deal with things like Mersenne Primes or Collatz sequences. On the other hand, there are problems like "Maximum Path Sum" which definitely make use of DSA-style tricks (https://projecteuler.net/problem=67).

Re: Project Euler #912: Where are the Odds?

#86
post #73

I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language. I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code p…

Most of these wouldn't qualify as "puzzles", would they? I find it nice to learn new languages via data structure puzzles, because to me the data structures of a language feel like the grammar and once I have that down everything else falls into place

I disagree. Yes, you have to learn how to work with the basic data structures of a language, but 90% of programming, for most people, is not that. It's IO, error handling, db querying, logging, input parsing, parameterization, business logic, preserving backwards compatibility, persistence, state management, testing, mocking, benchmarking, build design (for lack of better term -- futzing around with Make/Gradle/Npm, Dockerfiles). All of that doesn't just fall out of learning DS/Alg's, it takes time to become familiar and fluent in how all these are done in your ecosystem.

When employers or team mates ask you if you "know" or "are competent in" Java they don't care if you know how to work with lists, arrays, loops, hashmaps and sets. Well, I mean, that's table stakes. They're asking if you're familiar with the idiosyncrasies of the language with respect to those above concerns.

Re: Project Euler #912: Where are the Odds?

#87
post #82
post #55

Earlier quoted context omitted.

to be fair, PE is not designed or meant for helping people learn a language. that isn't the project's intent. people do like to say they use PE for learning new languages, but I doubt that is a useful exercise beyond maybe the first dozen problems or so. And even then, if the solution isn't obvious to you, you're doing two things at once - learning a language and solving a math puzzle. I don't see why people would si…

> I don't see why people would sign up to get frustrated like that. I actually use this as a learning trick. Pick two or three things to learn simultaneously, then when I get stuck on one aspect, switch to another. When I finally switch back, I often find the background time I gave my brain to process the problem means I'll now be much faster to get unstuck on the original issue. There's definitely ways this can go s…

I guess the trouble is that in the case of LeetCode/PE, people actually just want the one thing (programming language proficiency), and not the other (mathematics). Learning 2 things at once can be very useful, but a lot of people would probably choose something else for their second skill. Most relevant for developers might be, networking, OS's, version control, databases, testing, CI/CD, security, concurrency.

Re: Project Euler #912: Where are the Odds?

#88
post #73

Earlier quoted context omitted.

Most of these wouldn't qualify as "puzzles", would they? I find it nice to learn new languages via data structure puzzles, because to me the data structures of a language feel like the grammar and once I have that down everything else falls into place

I disagree. Yes, you have to learn how to work with the basic data structures of a language, but 90% of programming, for most people, is not that. It's IO, error handling, db querying, logging, input parsing, parameterization, business logic, preserving backwards compatibility, persistence, state management, testing, mocking, benchmarking, build design (for lack of better term -- futzing around with Make/Gradle/Npm,…

I think you overestimate the proportion of programmers who primarily work on corporate stuff.

Re: Project Euler #912: Where are the Odds?

#89

Earlier quoted context omitted.

Wow. The idea of getting to 100% on PE is almost incomprehensible to me. I've solved basically none outside the first couple pages. What was your strategy like? How much math background do you have?

I've got a bachelor's in math, but that's 40+ years ago. I had intended to go on for a PhD in math, but fell into computers instead - programming was easier and way more lucrative, even in the early 80s. Once I was retired and found my way to Project Euler, it became an obsession, tickling that desire to go deeper into math that I had in my college days. I attacked roughly the first 250 problems in order. The early p…

I feel a lot better knowing that searching the literature is supposed to be a normal part of Project Euler.

Re: Project Euler #912: Where are the Odds?

#90

Earlier quoted context omitted.

Lattice Paths — https://projecteuler.net/problem=15 > Starting in the top left corner of a 2x2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. ─────────┐ ────┐ ────┐ ┌───┬───┐│ ┌───│───┐ ┌───│───┐ │ │ ││ │ │ │ │ │ │ ├───┼───┤│ ├───└────┐ ├───│───┤ │ │ ││ │ │ ││ │ │ │ └───┴───┘│ └───┴───┘│ └───│───┘ ▼ ▼ └────▶ │┌───┬───┐ │┌───┬───┐ │┌───┬───┐ ││ │ │ ││ │…

Am I missing something here or would that be as simple as 2N nCr N for an NxN grid?

You’re not missing anything. This is an easy problem aimed at people who are not familiar with basic combinatorics.
Post reply on HN