The best technical interview I ever had involved picking a random Project Euler problem in the hundreds and pair-programming our way through it. The CTO wrote his version in Python and I worked in Perl . . . he was astounded mine ran 8x faster.
The same company also had regular hack night where everyone drinks a lot of Tecate, agress on a Project Euler problem and a language no one knows, and races. Fun times.
When I was conducting quantitative interviews I ended up doing the same thing. One of my favorite problems to give was 267 (http://projecteuler.net/problem=267). It has a few "aha" moments but also requires coding to get it done.
It surprises me that there's a unique 12 digit answer to this. If you bet proportion f of your income every round, then if you win n coin flips, shouldn't you have (1+2f)^n (1-f)^(1000-n) £? For a given f, it takes a certain number of heads for this value to exceed 1B£, but I'd expect a range of f values that all require the same minimal number of heads results to break 1B£. Unless there's a value of f that produces exactly 1B£ for the minimal needed number of heads (or the set of such f differ only after 12 digits). That seems unlikely...
EDIT: Just realized that the problem asks for the odds of being a billionaire, not f. So there are probably a good number of f that work, but they all produce the same odds.
Hey, thanks. This was a fun problem. I got a little bit obsessed though, and I wonder if it might be possible to finish the problem on pencil and paper. I am sure I can finish an approximate version, but I am not sure I can get 12 digits. Did you try something like this?
P.S. I must apologize for abstractly referring to a solution approach as "this", but I didn't want to create a spoiler in case anyone else had felt inspired.
I wasn't able to do it with pen and paper and suspect it's not possible. The 1000 flips and the 1 billion is arbitrary so it seems you'd always have to work with real numbers. I may be completely wrong though.
Hey, who did you interview and for what position? And how many of these people succeeded?
I've solved about 50 project Euler problems, but only 1 or 2 with number above 200. I'm not a genius, didn't study maths, but it's imho quite hard to solve any Euler problem at an interview, even if you're a decent thinker. Ok, there are few easy ones, but none of these with 3 digit numbers.
It was for quantitative engineer roles at Yodle (adtech startup). The goal wasn't really to get to a solution since it's not possible without sitting down to code but more to get them thinking about it and how they'd structure the problem. I don't remember offhand how many people got it but the ones with a statistics/data background ended up having the right approach and the ones that didn't got it with a few hints.
You might like Rosalind (http://rosalind.info/). It's like Project Euler, but with a strong bioinformatics (espeically) genetics slant. There is certainly math, especially combinatrics (for obvious reasons), but much more so that Euler there is background given in the problems, so it's often much more about coding a reasonable implementation than about knowing some obscure corner of number theory.
I really enjoy the types of problems on PuzzleNode[1]. My local coder meetup does one each month for code reviews. Their puzzles are just deep enough to where you need to think through how you'll design the system. They're really fun for exploring different programming techniques.
A lot of Project Euler is very "mathy", requiring you to read up on some mathematical shortcuts - I think https://www.hackerrank.com/ is a bit more CS-focused, i.e., there's always a specific data-structure or algorithm that solves the problem.
Thus, w being the number of times I win, I get the total $$ we would have:
(1+f)^w x (1-f)^(1000-w)
But those cases are not equally likely, so we have to ponderate them with a normal law centered at 1000/2, variance at sqrt(1000/4):
(1/(sqrt(2xPi)xsqrt(250))) x exp(-(500-w)^2/500)
So, now we can take an f, calculate the number of w's that put us above 1B$, and sum up the ponderation for each case. Then find the right f that optimized the chance of being a billionaire. This chance is the solution.
I get 1/4 as the optimal value for f. Given a 500/500 win lose, then final money = (1-f)^500*(1+2f)^500 = (-2f^2+f+1)^500. To find the maximum, the ^500 is irrelevant. Differentiating and finding a gradient of 0 gives: -4f+1=0 or f=1/4. Just by checking values, it seems I need to lose more than 555 times before I finish with less then 1 billion. I'm not sure how to calculate the probability of that, your formula doesn't seem to work. In any case, the problem seems to be purely mathematical rather than requiring code to be written.
It's actually 1+2f versus 1-f. (I agree that the wording is not very clear. I misinterpreted it too at first and was very confused at how my solution was being rejected. If you look at the short worked example they give, though, it's unambiguous.)
You're using the normal approximation to the binomial distribution. It may or may not be a good enough approximation. Better to do the binomial thing exactly. This requires arbitrary-precision integer arithmetic, but that's pretty easily available.
The Kelly criterion doesn't quite apply in this problem, since you are asked to optimize a more conservative strategy, namely to guarantee (with high probability) a certain amount of winnings rather than maximize log(winnings). In fact the Kelly value for f (in the problem's notation) is 0.25.
I used something else - don't want to give too much away but the general idea is to try it on a smaller problem (4 flips, $5, etc) and seeing if any patterns develop.
Yea - then we just walk through their answer to make sure they get the reason it works and ways to improve it. It's usually quicker and leaves time for another question that they hopefully haven't heard.
Sounds neat, but doesn't sound like pair programming to me. Sounds like you designed a solution together and then went and coded it separately? Or did you each code up the solution in front of each other? If so, a fairly interesting thing there would be if the person coding in Python was driving the other, and vice versa for Perl. Then again, that could be very annoying if the person didn't know how to type the language and it just because and exercise in transcription.
We were pair programming with myself in the driver seat, so to speak. I didn't code Python fluently and he didn't code Perl fluently, so we just implemented the same logic in our respective dialects.
I can't adequately express how great of a resource Project Euler is to someone learning about programming.
The way I learned to code was working my way through Project Euler problems in Python, eventually getting to a score of about 55 before I was at the point where I decided to try making "real" programs like Android apps.
When you learn to code people tell you that X or Y is bad for performance, and you should do A or B instead. The problem is that most beginner-type programs run in a few milliseconds and there is no way to see the performance either way. When you're doing a PE problem, a performance tweak can change your answer from a 1-minute runtime to a 1-second runtime. That's something anyone can appreciate, and it lets you experiment with performance on interesting math problems.
Another advantage of Project Euler is it makes you realize just how powerful a computer can be in the right hands. These are problems that nobody in their right mind would try to solve by hand, but they're so tractable with programming knowledge. That was a very exciting realization to me and it pushed me towards a career in software.
I love project euler, but I've come to the realization that its purpose is to beat programmers soundly about the head and neck with a big math stick. At work last week, we were working on project euler at lunch, and had the one CS PhD in our midst not jumped up and explained the chinese remainder theorem to us, we wouldn't have had a chance.
I feel the same way. It was presented to me as a great way to learn new programming languages. But really it's challenging your ability to design algorithms, and overwhelmingly mathematics-related algorithms. (I'm not saying the site itself claims anything different).
It doesn't heavily challenge you to advance past a most basic level of a programming language. For example, most Project Euler problems are solved in Java most efficiently by using the features of Java that map 1:1 to features in C. You could do pretty much the entire suite of problems without even understanding the motivation of a language like Java.
I did find it better as a tool for learning functional programming languages (like Haskell) however, perhaps unsurprisingly.
Stop doing that and its a lot more fun. It annoys me when a PE problem is specifically designed to make it impossible if you do it the "wrong" way. Most PE problems allow crazy solution strategies. The bad ones only have the one true way that is computationally feasible.
A few posts up someone liked problem 267. I would pick random numbers, run them, then keep the winner and make n-1 new random numbers for round 2 and keep running rounds of multiple threads until bored, remembering the best result so far. Yes, that is not a very smart way to solve the problem, but its a very fun way to exercise the heck out of your knowledge of threads in some new language. Or you could make an insane thousand thread pipeline and hope for convergence. Or a thousand processes on a parallel cluster pipelined together. Could I write my random processor using BASH to baby sit a bunch of octave instances? Newtons method at least at first glance would be too easy. Could I solve it graphically, literally, by graphing some results and doing image manipulation and analysis of the generated graphic file to obtain the numerical result and feeding back for more "zoom" detail? Totally ridiculous unless the whole point is some weird computer vision project. Given an emulator for a IBM1620 mini-mainframe from the 60s, could I write a perl script that output random Fortran-II test runs for the emulated mini-mainframe to compile and process and then another perl script to eat the virtual "printer" output of the mini-mainframe to get random run results? Problem 267 looks like a fun one to solve the wrong way.
This is the unfortunate part of PE becoming popular at interviews. First of all it surely has nothing remotely to do with almost all programming jobs, secondly, "having fun while doing crazy things" is probably not the ideal IT department mission statement or employee selection criteria (although it would explain some things I've seen over the years...)
The proper tool for 99% or so of PE problems isn't a programming language anyway, its octave/mathematica/parigp. So its not too far out of the spirit to try crazy stuff.
What we need now is more focus towards females. Men are already sufficiently saturated in the maths/CS fields. What we need is to market the idea of maths as fun to more females.
As a woman, I would definitely use Project Euler more often if they came out with a pink version that was smaller and more ergonomic to suit my soft, feminine hands.
As a female math grad and CS postgrad, I would like to say firstly that you have successfully trolled me. I do hereby take your bait.
Now for the points I would like to make, primarily for the benefit of the few who actually think as you claim to think:
Women are actually similar to men in a number of novel ways.
We have eyes, and those eyes are intricately connected to very powerful and compact organic computers—capable of independent thought—called brains.
That's right, men and women can both have brains.
And those of us women fortunate enough to be blessed with brains are quite capable not only of independent thoughts, but even decision-making. And yet another way in which we women are similar to men is that each of us, as individuals, comes to have certain aptitudes, preferences and values.
Some of us, like myself, discover to their amazement that they can understand mathematics and even think mathematically about pretty much anything, and develop an interest in technology and computation because of the possibilities it opens up for mathematics and because of the ways mathematics can reflexively provide insights into computer science and programming.
Other women have an aptitude/preference for: polishing nails; answering telephones; designing cute little things that men can give to women at Christmas; and so on. Are women like myself a minority? Perhaps, but it isn't because we have to be shown things like maths and programming with striking adverts, responsive websites and pretty flyers.
I'm not going to pretend that society has been engineered into a patriarchy, over thousands of years, as part of a sinister plot by the Illuminati to preclude the success and independence of the children of the mother-goddess.
I'm likewise not going to pretend to think that there are men with power who purposefully keep women from rising up, or give preferential treatment to male candidates for scholarships/whatever without even realising it. Because ultimately I have no proof of such things and neither do I care about some male-dominant society, because in my experience, what matters is the talent; if you have it, if you have an original idea, a way how to implement it, or if you're simply the best at what you do, you will succeed if you want to, male or female. I do not care why my boss, my clients or my investors choose me, I just want the opportunity to do what I do best, what I like doing.
If you think women simply haven't been exposed to the magical and fun possibilities of mathematics and computers, think again. If women were ignorant to these fields and what they involve, they wouldn't laugh at you for being a "nerd" or date muscular/rich guys instead of you.
They know what maths is, and they know what programming is, and they'll never want to visit a forum and tell everyone how awesome it was when they elegantly solved some mathematical problems or came up with a new proof for some random theorem. They will on the contrary yearn to talk about shoes, interior design, literature, art, perfume, TV shows, movies, diets and so on.
The select few women who prefer mathematics/compsci and find it genuinely fun and inspiring were already posting on newsgroups, were already on IRC, were already subscribed to ars technica and slashdot on google reader, were already here; and they are already here; or they will be here in the future, or wherever else that such subjects can be discussed in the future.
It is not a case of marketing the idea to a mass of women who have no idea what makes their iPhone so useful, or how their cars' brakes are engineered. Women do not go to fashion forums and tell everyone about how much I wish I could expose men to the glories of haute couture. Women do not tell their nutritionists how much they wish they could entice their male friends with raw food diets and veganism.
There are the lost, unwashed masses who will never amount to anything, who will become a carbon copy of their parents and aspire to nothing beyond some repetition-of-basic-tasks job in an office or in retail, and the members of these masses are of both genders. You will fail to "market" math/compsci to these people, regardless of gender, because they cannot do it. Women who aspire to something and want to succeed do not generally want to do it with math and programming.
So, to all of you who think women need to have math/compsci marketed to them: kindly stop talking crap and just ignore the gender issue. It doesn't do you any credit. Women are here. We don't typically scream that we're women because why should we? We're just professionals or students trying to succeed and learn, no different to you gents.
If you want to encourage women to get into math/compsci, have a daughter and buy her a cheap laptop and "The C Programming Language" when she's young. If she takes to it, bang, she had an aptitude that would have gone unnoticed and you saved her from a life of instagram and film studies.
If she deletes some system folders she doesn't think she needs, watches make-up tutorials on youtube and checks facebook every 2 hours, you know you've got yourself a typical woman.
Protip: I don't think the statistics of how many women study math/compsci will be much different in the aforementioned compsci-introduced generation of daughters.
Kids don't magically decide that math or science or computer programming is fun. They're heavily influenced by what they're exposed to and what they see other people they respect doing. Yes, that's "marketing" or perhaps better call it education.
And no, giving a kid the "C programming language" isn't going to cut it unless they've previously had enough exposure to math or engineering to understand why it's interesting. (Based on what I've heard, Minecraft seems to be working a lot better.)
Okay, perhaps I am being subjective. I got into this stuff on my own, maybe exposure makes a difference for some. But let's face it, there's no objective reason why math/compsci/engineering should be interesting even after you understand it. It's not like you can just explain it x many times and suddenly a girl will be like "wow it's so amazing and deep and clever." You and I may appreciate it, but can you say why? Can you give me the fundamental reason why it should be interesting as a matter of fact? Besides, we're in the 21st century. Girls can expose themselves to whatever they want. I don't think programming and calculus are terribly obscure.
I'm not sure calculus is a great example for your argument. How many kids do you think would actually learn calculus on their own? It's something that most kids think is way beyond them and they don't even know what it is (other than a kind of math) until they actually study it in school.
And that's a standard subject taught in high school. I think if instead you look at why kids learn music or art or dance or drama or sports or a foreign language or religion, you'll find that the parents and relatives and friends often (not always) have a lot to do with it. And even with parental support, often the kids decide it's not for them. And that's fine; at least they got the chance.
I don't see computer programming as being all that different; not every kid is going to be into any given activity, but if they're not exposed to it in a way that makes it seem interesting, that's going to drastically reduce the number of kids who even try it. And that exposure is going to vary pretty dramatically depending on where you grew up.
Hey, wanda, you got quenlinlom's remark totally wrong.
He doesn't really want to saturate female's lives with more math and CS. He wants his math/CS life saturated with more females.
He's hanging out with the wrong mathematicians. Or the ladies have, um, made a judgment, and don't want to intimidate him by their superior STEM achievements.
CS is a sausage fest as we all know here on HN. What most HN readers don't know is around 46% to 48% of all math undergrad degrees in the USA have gone to women since the early 80s.
You can read some hilarious articles online about the "crisis" that women have declined to a mere 45% in some years. I make fun of it because my EE classes had zero female grads, everyone knows CS is a sausagefest, why I remember a decade ago in an advanced C++ class I got to work with "the" girl in the class, all true stories, but if there's one thing not to fret about, its that an office staffed by recent math grads (McDonalds? Applebees?) would have either 10 of each or at worst 11 men to 9 women, hardly a staggering imbalance like you see in CS/IT.
The disconnect may be a result of what schools people are familiar with. At (Carnegie Classification) Research I universities men make up 64% of math and stats majors, whereas at Masters I there is almost parity. These university types are #1 (~8000) and #2 (~6000).
Still even 64% is hardly EE at Research I (85% male), so your overall point stands.
Given that you've got some emotional disposition against "feminists" and "liberals" [1], I don't think I'm going to buy your implicit effort to try to represent women. There are plenty of women who believe gender is an issue worth thinking about, whereas you seem to have no problem telling people to just "ignore" it because you're personally comfortable ignoring it.
I don't think marketing tech to women or girls is "the solution" either, but I don't make every effort to steer other men away from thinking about it and slur people for trying. That's intellectually malicious.
A part of me doesn't actually believe you're a woman, given how many men put effort into anonymously impersonating women in political debates, but I lean toward believing you
there are plenty of women who think gender is an issue
Women being paid less for the same job is an issue. Sexual harassment is an issue. Women treated as secondary when it comes to promotions/scholarships is an issue. Gender is not an issue and I just dislike the implication that women cannot find their way into tech if they want to. Are we concerned that the infantry isn't 50:50 men:women? Not bloody likely.
If you think me bitter, you're wrong. I am just tired of the trend to think of women as people with "special needs". I am perhaps concerned with gender more, after all.
I remember doing the Heighway Dragon one (somewhere in the 200s). Took me quite a while to write code efficient enough to finish in well under a minute. Then I get to the forums, and it's a simple combinatorics question you can solve instantly. It certainly inspires me to learn more maths.
I have to agree that the math is a bit too much. If you feel like doing algorithms / data structures work, though, perhaps leetcode will appeal to you: http://oj.leetcode.com/
That's true. Another one mentioned in this thread is hackerrank: https://www.hackerrank.com/ - this one offers way more languages, except for rust, the one I'm actually learning :(
Although it has Clojure (my target language), you still send code instead of an answer, and you get problems like not knowing what's available in terms of libs and whatnot.
> had the one CS PhD in our midst not jumped up and explained the chinese remainder theorem to us, we wouldn't have had a chance.
I never had a PhD near by to get help from, but many problems involved doing research online about a theorem, sequence or some sort of mathematical concept.
I was really into Project Euler when I had a job where I didn't have to do anything. I've solved 122 problems. Now I work for myself and don't have the time, as well I solved all I was able to solve. I last solved a problem in 2009 I think.
It's fun, I encourage everybody to do a few. Get past the easy ones at least.
To be honest, I'm shocked this is on the front page as this website has been out for years and already notably mentioned, but I guess it's good to recycle very important websites for those who haven't heard of it.
My favorite problems is 98. This problem, along with the Sudoku one at 96, require much more careful programming than some of the others due the drastically fewer number of people who solved it compared to the surrounding problems.
I love project Euler. A nice way to improve programming skills in a new language is to go through others solutions in the same language after you solved a problem. This allows to break bad habits. Say you are a C programmer learning Ruby or Lisp, 'C-ish' approach will often seem the most straightforward, but will rarely be optimal and idiomatic in the new language you are learning.
I solved about 80 of them, then my interest waned a little. But I wonder, are there any hints or recommended reading for the harder ones? Some of them I have no idea how to even start working on..
After the first hundred or so, you start to need more and more math.
If you don't know what to look for off the top of your head (which you probably wouldn't without a math degree), try to google around for math that looks relevant to your problem.
I am sorry, it's like 5 years back when I did it, and I don't remember (nor I am inclined in pursuing it further). (I didn't gave up because it became impossible, I just became less interested.)
But lot of those harder ones - as far as I can tell - required pretty deep knowledge of number theory, which even though I studied math (10 years ago), didn't have. I think it would be nice if there was sometimes a hint about what the people should study to be able to solve it.
and couldn't solve it. I found an article on mathworld that says the number of expected rolls is e so that the sum is over 1. I don't know how to figure out what the value of the roll that gets you over 1 is, it's something like 0.64 from simulation but what does that number mean and why?
There's only one problem for me with Project Euler. Eventually, the problems become more about coming up with the mathematical algorithm you need to solve it.
That may be what you want. However, a lot of these are outside my math knowledge/ability, without really expanding my programming ability.
I agree. I think the "hard" (and some of the "medium") challenges on codeeval.com are much better in terms of requiring coding ability vs requiring math ability. Math ability won't hurt, but it won't get you quite all the way there.
A lot of good links to similar sites in this comment thread.
I enjoy Project Euler, but as with many people slowly got annoyed by lack of specific mathematical knowledge as opposed to programming. One thing I believe would really help with this would be a resource that discussed the problem in the abstract. As an example, for most of the programs that rely on using primes, whether it be iterating them (e.g. first 1M primes) or the unique prime factorization of a number, discuss the known algorithms in pseudocode. Perhaps this is a bit much, as I would be satisfied with just knowing the words I need to go find resources for myself. This is what I tend to do anyway after I have taken a fair stab at a problem: "Oh, I'm doing prime factorization. I wonder if there are better algorithms than I have used." Indeed, one resource for this is the forums that are made available after the problem is solved.
Some might see this as ruining the fun, but I would personally have more fun and solve more problems if this was available.
In my opinion it may be better to do practice SRMs/Codeforces contests instead of project Euler. Topcoder rank imo tends to mean more, since it is timed. If someone says "I solved x problems on site X" you can't say if he done it in days or weeks of effort. If someone says he's red on topcoder you can say he's awesome.
Project Euler is great but as others here have said it is very math focused. Can anyone share other programming challenge sites? I saw one the other day here on HN in a comment but can't find it again. The only thing I remember is the problem I checked out was a kind of AI / pathfinding for a "floor cleaning robot" and code was submitted directly in the page.
The UVA Online Judge [1] is one of the largest and oldest programming competition sites on the web. They have a huge library with problems in pretty much any CS area. However it can be a little overwhelming at first, so is better to use UHunt [2], which categorizes problems according to difficulty and area, such as Data Structures, Computational Geometry, String Manipulation, etc.
Back when I was working on PE problems, I had a spreadsheet of the problems and I'd sort them by the ratio of solvers to solvers of the preceding problem. It's a handy way to find the low hanging fruit and partially eliminates the recency factor.
It's possible that a different one has been solved by less people. E.g., if someone created multiple accounts, submitting to the same question multiple times, increasing the Solved By count artificially.
I'm trying to go through this with Ruby right now and having a lot of fun. Being a bit rusty on basic algorithms and higher algebra has not helped much, though.
Tangentially related: I made a pseudo-terminal web interface to Project Euler called CodeBot[1]. You can view problems, submit solutions, and do much more (some *nix commands work) in your browser. Its even open-source[2] on GitHub
These are a lot of fun to do, especially in a new language you want to play with. However they are as much an exercise of your math skills (mostly basic number theory and combinatorics) as programming. One thing I'd suggest is that you pick an algorithm reference and stick with it, if you google anything too specific you will come across one of the many sites where people have blogged about thier solutions.
I always love this site for when things get a little slow and I think I could use some relaxation.
Then I remember that I only took a little bit of math, so then there's the research, the papers to read and decipher, the code to write, and I finally solve the problem and swear I'll never come back.
So, yeah, I just finished a batch of problems last week so I could get a couple of ego badges just within reach. 75 down, 379 to go!
I always liked this set of challenges/riddles, though it is directed at Python specifically. I appreciated that it forced you to deal with some Internet-related programming tools and concepts.
The best and worst thing about project Euler is the binary feedback they give you: either you pass or you fail.
On the one hand, it is a good lesson in how hard it can be to write correct code.
On the other hand, real world problems aren't black boxes where you try an integer until you get the right one. Problems with multiple tests needed to pass (like topcoder) are much more realistic.
Weird, I was just talking about this earlier when someone asked for productive activity on train journeys to/from work.
I used to do these problems years ago when I was still a student and later when commuting to London. I did as many as I could on paper before trying to program solutions. I'll have to log in sometime and finish the few I missed.
Learning haskell with ProjectEuler right now. It's great and after solving it, one can always look up the forums and improve the own code or learn different ways to implement the solution!
A dozen Project Euler solutions in a given language can be an excellent pre-interview candidate screening technique. Quite simple to check for plagiarism too, within reason.
A dozen? Perhaps a dozen of the easiest ones that one can do in a few minutes, but even so it seems like a lot of work for a pre-interview screening. But many Project Euler problems require a great deal of thought and are mostly testing mathematical prowess.
How much work are you comfortable making your candidates do before they even know whether they're getting an interview?
Yep sure, I'd expect any competent programmer to be able to bash out the first dozen without it being too onerous. Think of it as FizzBuzz-on-steroids. Remember this is only a screen, and it's something many programmers would find to be fun anyway!
Our time is still finite, especially when we are in job hunt mode. One party should not expect the other party to invest a lot of time in the process without doing so themselves.
I'm particularly sore because I spent a bunch of time working on learning something domain-specific for a potential employer who verbally indicated the interview process would be proceeding, but then forgot to tell me for a week they had decided to end the process.
Well, I just did it. It took me about 35 minutes. I am terribly, terribly old (43 years) but I'm pretty sure I am a more than competent programmer and I have a very strong mathematical background. I was working on a laptop but a reasonably decent one, in an environment less distraction-free than an interview room but still not bad. I didn't particularly go all-out for maximum speed but wasn't gratuitously slothful.
I (deliberately) didn't use a programming language with, e.g., facilities for prime factorization built in; that would have made it much quicker but would also have made the whole thing useless as a programming test. So I had to implement the sieve of Eratosthenes, the number-of-divisors function (via prime factorization), etc.
I estimate that about 8 minutes of that time was the result of a couple of silly bugs. (It's surprising how many seconds one can lose to forgetting that 16 is less than 20.) That figure could easily have been zero or twice as much. I lost perhaps two minutes to spousal distraction.
These are all straightforward problems; in no case did I have to spend more than a few seconds thinking how to proceed, though in a couple of cases my response to having written buggy code was to replace it with something more simple-minded.
recursive, I invite you to actually sit down and implement solutions to the first 12 PE problems in, say, Python or Ruby or some similar language and tell us how comfortably under 30 minutes you come in. For the avoidance of doubt, I'm not at all saying you won't manage it -- I wasn't far off and you may very well be quicker than me. But I'll be surprised if you're so far ahead that after the exercise you still think every competent programmer should finish in at most 30 minutes.
(My rough timings for the 12 problems, in order, in minutes: 1, 1.5, 1.5, 1, 3, 1, 3, 2, 1, 4, 5, 10. These figures include bugfixing and checking against the PE site. Total lines of code: about 115.)
Right, sure. So pick n of them, say any n, or a list of problems you think are suitable (enough to act as a filter, not so much that they'd take too much time). I interviewed with a company last year that wanted any 10, and resolved to steal their technique for my own use. Did well enough to get to the next stage, tho' ultimately didn't end up working there.
In the same vein, spending a couple of hours working Project Euler questions before you go into an interview is a great way to warm up for the types of questions you tend to get in interviews but don't see as much during day-to-day programming.
True, but if you are interviewing, this might be an easy way to have a github repo that has an example of your coding style: comments, function and variable names, etc.
... I am kicking myself that I have never done that.
Aside from the official rules, its socially frowned upon given the magic power of google. At least that was my experience. Private repo, fine, just as long as google can't find it.
Even though I know python fairly decently, I found working on Project Euler problems improved my Python skills a lot - in particular, I had not had much awareness, nor need for the 'yield' command, but I ended up using it a lot on PE problems.
The same company also had regular hack night where everyone drinks a lot of Tecate, agress on a Project Euler problem and a language no one knows, and races. Fun times.