Subj : Re: puzzle To : comp.programming From : karen Date : Thu Jul 07 2005 07:52 pm wrote in message news:1120211926.453597.228690@z14g2000cwz.googlegroups.com... > > > karen wrote: >> wrote in message >> news:1119341868.873117.107560@g44g2000cwa.googlegroups.com... >> >> ok here is a puzzle. >> there is an integer array whose length is odd, and all the numbers in >> the array appear exactly two times except one. Find the number in O(n) >> time. Try to do it without using any other data structure. >> >> Note that word "INTEGER". It doesn't HAVE to work for floating point >> systems! > > Real programming is not a matter of solutions isomorphic to problems, > and responding to one problem as expressed "today" with a solution > tuned to that problem. > > Instead, the real programmer recognizes, as an aura around the user's > expression of the problem, a genuine class of problems to which today's > problem will evolve. > > Conducting itself as an Adult in relation to the user's Adult, real > programming insists on joining the user and in many cases seeing > further. > Real programmers do indeed need to look past the original specs and see if there is other data there to indicate that the problem is not completely defined. But they should also be careful of going beyond specs when those specs are set. The boss doesn't want you to make a rigid solution that has to be rewritten when the specs stretch a bit. The boss also does not want you to spend all of your time finding a solution that covers everything, including things way outside the spec, and end up not producing everything. The boss wants you to solve a problem well and completely and in a timely manner. So, is there anything else besides the original spec to give us more information? Why yes, there is. The subject line is "puzzle". A puzzle means that they aren't looking for a complete, expandable, useful in all cases piece of code. "Puzzle" means they are looking for a slick solution, something that may not be useful anywhere at all, and something that fits the specs as listed. Now, if the OP were looking for an actual solution to a problem, that would have been different. And, if it's any consolation, I'm glad you requested more information on the actual slick solution. I'm not so good of a programmer that I could have figured it out with just clues. So some of us needed more. And if the OP was trying to get his homework done, well at least he had to wade through a lot of reading before the answer was handed to him. -karen .