News for hackers. Stuff that matters.
Re:Leetcode has taught me that I'm a bad engineer by josephg on Wednesday January 05, 2022 @04:25AM (#29806899)
Weird. I'm (probably) ADHD spectrum. (I've never been properly diagnosed, but its all very familiar).

I love puzzles though. They're short, they have a right and wrong answer. Optimization problems are especially satisfying because you can get a score, and improve on it over time when you come up with clever ideas.

I've never done any problems on leetcode, but thats absolutely my wheelhouse and I love that stuff. A few weeks ago I invented a new String (Rope[1]) class by combining skip lists and gap buffers. I don't know if anyone else has ever done that before. Its 3x faster than the next fastest library I could find. There's probably an academic paper in that, but that sounds really boring.

Maybe its useful for other people, but I think if you said "leetcode is a training process" to me, that'd make it more boring. For me the fun part is finding those puzzles in regular code. ("Sure this algorithm is simple but its n^2. I wonder if there's an O(n log n) approach out there somewhere..?")

[1] A rope is a "fat string" for text editors and things, where you want to insert / delete characters at arbitrary positions. My library is here - https://crates.io/crates/jumprope

Re:Leetcode has taught me that I'm a bad engineer by pasabagi on Wednesday January 05, 2022 @06:43AM (#29807833)
Perhaps it's more attitude, then? What you said does sound interesting - I just never think like that when I'm solving puzzles. When I think puzzle, my mind goes to something like a rubics cube - an object where there's some trick that once you've learned, the object becomes 'solved'. That abrogates any need for creativity, since the solution is already preordained in the design of the puzzle itself, so I just get irritated and (usually) find some way to cheat it.
Re:Leetcode has taught me that I'm a bad engineer by josephg on Wednesday January 05, 2022 @01:17PM (#29812787)
Yeah; I never learned to solve rubicks cubes for exactly that reason - what’s the point of memorising a solved algorithm that only works on this one problem anyway?

But plenty of algorithmic ideas are broadly applicable and useful. Eg, b-trees, bloom filters and priority queues have some wild uses across a host of problems. Those tools strike my fancy.