7 ms·
Puzzle interest may be one aspect of it, but I and others too I would assume, are in it for the creativity and fantasy. I knew basic in 2nd grade and made simpl
by cwingrav 7y ago
Puzzle interest may be one aspect of it, but I and others too I would assume, are in it for the creativity and fantasy. I knew basic in 2nd grade and made simple little games. Later I learned to use a hex editor to hack saved computer games. I switched to CompSci in college because of the Internet. Today, I love building projects and hacking electronics (and wish I knew more!). I never really had a thing for puzzles, just creative creation.
- TeMPOraL 7y agoYup. I'm pretty anti-puzzle, I don't like solving completely arbitrary, artificial, self-contained problems. I've always found them boring (though these days I appreciate their instrumental value). That's why in high school I could easily code circles around everyone else (including the teachers), but I never was the best in the algorithm olympiad. I learned programming to make games, not solve random word problems from exercise books.
- silveroriole 7y agoAlso often the puzzles have very little to do with your coding skills and everything to do with knowing some mathematical trick. Don’t know if it’s still the case but when I was in uni everyone told you to do Project Euler to prepare for interviews/learn coding. God help the people who had that as one of their first encounters with programming, I would have been turned off it for life!
- TeMPOraL 7y agoExactly. Now to be honest, over the years I've learned to appreciate the power multiplier deep math knowledge is, but that's not what interested me in programming. And most of the time, it's also not what's useful in a job context.
- 0x445442 7y ago> Also often the puzzles have very little to do with your coding skills and everything to do with knowing some mathematical trick Yeah, my favorite "puzzle" that highlights the folly of such things is this; write a function which, given the number of participants (n), returns the number of games/matches necessary to be played in a single elimination tournament to determine a winner. I actually asked this question in an interview once, only I was the interviewee. I had just fumbled about with all the nonsense algorithm problems that had no relevance for the job when the interviewer asked if I had any questions. I popped that one on him and to my surprise he actually took up the challenge. But since he didn't know the trick he fumbled about on some recursive goose chase.
- barbecue_sauce 7y agoI don't even know what a single elimination tournament is.
- schoen 7y agoIt's a tournament where the loser of each match is immediately eliminated from the tournament. Normally with a tree-structured bracket, or as nearly as possible.
- sirsar 7y agoThis doesn't sound much like a trick[0] question to me, it just takes working out a few examples by hand to guess that it's `n-1`, and the proof isn't hard either. And the result shouldn't be surprising: if sorting can be done in O(n log n) comparisons, it should be easier than `n log n` to just find the maximum/minimum element. Even without doing any math, or proofs, or having any algorithmic background, it shouldn't take "fumbling about on some recursive goose chase" to write the function from first principles: >>> def games(players): ... if players <= 1: return 0 ... if players == 2: return 1 ... return 1 + 2 * games(players // 2) ... >>> games(8) 7 If your interviewer couldn't come up with that, I wonder how well they do with real-world recursive algorithms on the job. It bears some resemblance to real-world problems I've had: groups of IPs combining into groups-of-groups-of-groups for addressing, computing permissions for teams-of-teams on the org chart, etc. [0] To me, trick questions involve some hard-to-come-by "aha" moment, like the XOR trick to swap two variables without a temp. This one doesn't seem to have that.
- 0x445442 7y agoIt's even easier than that... return players - 1. The trick is knowing in any single elimination tournament in order for there to be one winner there must be n - 1 losers. edit: Also, I'm not sure your solution works for 13 players.
- sirsar 7y agoI wrote that it was `n-1` in my comment. Doesn't seem like much of a trick to me.
- bambataa 7y agoI was actually put off taking up programming for a while because of this "it's for people who like solving puzzles" attitude. Admittedly I have spent days tracking down bugs in personal projects because I couldn't leave them in a broken state, but that was partly because I'd done so much work already that to leave it crippled by a bug seemed criminal. But solving Rubik's cubes? If you enjoy that go right ahead, I'll be over here doing something interesting. I feel the same way about the kind of problems that appear in pure mathematics books and I worry I'm missing out. Colouring adjacent tiles or whatever doesn't intrinsically interest me.
- wool_gather 7y ago> I have spent days tracking down bugs in personal projects because I couldn't leave them in a broken state I would still call this "puzzle" solving like the OP was talking about.