I've done that on a technical interview. They asked me to, in Javascript, reverse an array of 100 numbers.
I did something super simple, like this (this is pseudocode):
SourceArray() = Int(100)
TargetArray() = Int(100)
For I = 1 to 100
{
TargetArray(101-i) = SourceArray(i)
}
So they all sat there in stunned silence.
I asked, "Good?"
They responded, "Nobody has ever come up with that solution before."
I asked, "How did most people do it?"
They responded, "Sorting. Bubblesort, Quicksort, all sorts of stuff like that."
I said, "None of you thought of this?"
They answered, "Nope."
I was polite enough to complete the interview, but upon leaving, I called the recruiter and withdrew. I will not work with morons.
Ping to the above ^^^
I hear you. I’ve had some weird interview questions, but I didn’t react that way, because I needed a job, was unemployed at the time.
If you had taken the job, pretty soon, you would be running that company. Nothing wrong with that.
My bosses, who were generally very good and knew the legacy systems very well (so I usually deferred) once came up with a solution to a looming problem.
They pretty much spent 2 days coming up with a solution covering at least 2 whiteboards in a conference room.
They asked me to review their work. After 30-45 minutes I suggested 10-15 lines of code that would do the same thing. Easily.
Nope... Made me implement their solution. Probably took me the better part of two days and I could have had it all done in very little time.
That was 40 years ago.
That is classic.
I recall reading that solution somewhere...
Anyone who would use a sort to reverse an array ... [sigh].
Tell them to array their damn numbers in the correct order in the first place and walk out.
Then come in on Monday morning like you have the job.
They said FORTRAN, it's what they know. I wrote it out on a legal pad. I got an offer from them, but I didn't accept it.
-PJ
They asked me to, in Javascript, reverse an array of 100 numbers.
.....
They responded, “Sorting. Bubblesort, Quicksort, all sorts of stuff like that.”
> reverse an array of 100 numbers.
You gave them an O(n) solution. Not a comp sci major on the whole other side of the table. You’d spend the majority of your time there trying to explain to them why their solutions were so non performant.