3 ms·
I studied applied math instead of computer science, and the exercise took me a good 15 minutes plus some time to adjust to C as I've only worked with C++. Then
by masterj 16y ago
I studied applied math instead of computer science, and the exercise took me a good 15 minutes plus some time to adjust to C as I've only worked with C++. Then another 5 to simplify some redundancies. I believe the solution I came up with was elegant, correct, and idiomatic.
Does this mean I'm not a good programmer? If I worked with C and pointers a lot then it might, but I find the attitude that not being able to slip into that mindset immediately equivalent to being an inept programmer arrogant.
- axod 16y agoI'd say that a good answer is a good answer regardless of language. I wouldn't personally care what language someone wrote the answer in as long as they got the key concepts which in this case are pretty damn simple - Have a source pointer, have a destination pointer. Copy stuff from src that you want, over to dest. Leave out any bytes of value N. Don't forget to copy/make a new 0 at the end. And that's it. That's being a programmer. Knowing some particular languages syntax isn't. That's the easy/irrelevant bit IMHO. So it really depends on if that 15 minutes you spent was to arrive at the 'solution' I wrote out in words above, or if it was checking up syntax to write it in C as to wether you're a good programmer or not. Just my 2c.
- sokoloff 16y agoI just submitted a solution. I believe that one can tell "has this person written a non-trivial amount of C code?" from 15 seconds glancing at their answer in your peripheral vision. I agree that it can be solved essentially the same way in many languages, but the idiomatic Erlang solution will look a lot different than the idiomatic C solution. Edit: After reading some of the code posted here and linked from here, perhaps I don't have the same sense as others of what the idiomatic C solution is either. This should be interesting to read the followup posts by RoG.