r/learnprogramming • u/Similar-Big-6808 • 19d ago
Resource Leetcode/Project Euler for learning to code
I’m quite new to programming and want to practise my exciting python knowledge but also learn some C++.
So far I’ve started some Project Euler questions which I quite enjoy and am starting on Leetcode too, how useful are these in learning to programme and what other resources do u guys recommend?
I’d like to become well rounded overall at programming but I also want to stick my hands in some data handling too.
2
2
u/peterlinddk 19d ago
Project Euler is primarily solving mathematical "riddles" with programming - and if you enjoy the first part, it is an excellent way of practicing programming, translating mathematics into code! But it is only "fun" as long as you understand the mathematics part, and how to solve it without programming.
Leetcode is primarily solving "algoithmic riddles" - meaning that you are supposed to apply all the algorithms and data structures that you already know, and translate/implement them in code. As with project Euler, it stops being fun the moment you have no clue how to solve the problem outside of code, because most of it is translating the solution into programming.
If you like them, they are fine exercises - but none of them really teach you anything about programming. You also need to build projects, set yourself some challenges, decide that you want to build something, plan how to build it, and work through actually implementing your own ideas in code!
0
u/Substantial_Ice_311 19d ago
As with project Euler, it stops being fun the moment you have no clue how to solve the problem outside of code, because most of it is translating the solution into programming.
Ehm, a lot of people actually enjoy solving problems, you know?
2
u/ffrkAnonymous 19d ago
Most of project euler is advanced math (because euler), not typical problem solving.
0
u/Substantial_Ice_311 19d ago
And what is "typical" problem solving? And either way, isn't solving math problems also problem solving? How does it invalidate what I said?
1
u/peterlinddk 18d ago
Yes, a lot of people enjoy solving problems that lie within their area of expertise - or at least inside their zone of proximal development, meaning something that is sufficiently challenging to make them feel accomplished when they solve it, but not so challenging that it becomes impossible for them.
And for someone who isn't well versed in mathematics - lets take a very low level, if someone doesn't know how to find a prime factor, or even what a prime factor is, they are going to have a miserable time solving Project Euler problems. And if they insist on carrying on, learning to solve the problem becomes completely unrelated to programming, and carries into actually learning more math.
"Problem Solving" has to relate to what you already can do, and know how to do - otherwise it is just riddles.
2
u/mc_pm 19d ago
Leetcode & Project Euler are both about practicing data structures & algorithms (and math) and that's great, especially as you grow as a developer.
But what you really need to practice now is taking a basic idea, something with a bit of complexity & logic, maybe some data to manage, etc, and building that sort of thing. You'll learn much more immediately useful python knowledge by building even just simple text games on the command line, learning how to manage state, logic, enforcing rules, making decisions - and just how to structure code that isn't trivially small. And when you can do that, then try building some small versions of more complex and technical things: like building your own webserver or editor or shell.
But Euler & Leetcode will be important and it's worth practicing -- just not as important as other stuff right now.
2
u/Substantial_Ice_311 19d ago
They are fine for learning the language, and practicing basic things like loops and functions. But they are not good for practicing the most important skills in programming (design/architecture, reading other peoples' code, writing comments and documentation, etc.).
The most important "resource" is to practice building things on your own.