|
Jeremy Falcon wrote: And while you're at, can you stop space and time and develop the first programming language used on Mars and feed that back to us?
Well, we already have the first programming language to be used on Jupiter (JOVIAL)
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Touché!
Jeremy Falcon
|
|
|
|
|
don't you just love the way JS let's you express your thoughts?
|
|
|
|
|
Jeremy Falcon
|
|
|
|
|
Look at this stupid C# code I wrote that allows you to do only one for loop.
int [] data = {0,1,2,0,0,0,0,0,5};
List<int> allData = new List<int>(data);
var originalSize = allData.Count;
var counter=0;
for (int x =0;counter<=originalSize;x++){
if (allData[x]== 0){
Console.WriteLine($"got 0 : {x}");
allData.RemoveAt(x--);
allData.Add(0);
}
counter++;
}
data = allData.ToArray();
Console.WriteLine(data);
I've provided multiple data sets to test the data. It works.
EDIT
i was trying to reproduce what I could do in JavaScript. See above... The Lounge[^]
|
|
|
|
|
|
OriginalGriff wrote: That's probably even less efficient than my Linq code!
But it works!!
|
|
|
|
|
yep, I was once asked a question of if you can only have two variables how do you switch their values. I was in a peevy mood(due to idiot I was interviewing with) and didn't really think before I answered. But I essentially said never happens in real life and why the heck do you want too and dude it really isn't possible. Once I thought about it for a second(a week later) I understood it was just a theoretical question. But hell.
a = 15
b = 5
a= a+b
b = a-b
a = a-b
But would that ever happen in a real life work environment?
To err is human to really mess up you need a computer
|
|
|
|
|
rnbergren wrote: But would that ever happen in a real life work environment?
That's the point. If this was systems programming or device programming I could see that. But for your typical LOB app...
Jeremy Falcon
|
|
|
|
|
There is an old trick from days when memory sizes were counted in bytes. (No I did not figure it out and had to be taught it.)
Use three exclusive or operations. This will avoid the overflow issue of using add and subtract.
For example:
a = 15
b = 5
a = a^b
b = b^a
a = a^b
|
|
|
|
|
I've always liked this trick since I first saw it in an assembler manual for PLAN (there must be other OPers who remember PLAN). The only problem with it is that it only works with integers.
|
|
|
|
|
I remember that from my C days. If someone asked me that in JavaScript though I'd have to take a step back end think about.... a lot. I miss a good XOR at times.
Jeremy Falcon
|
|
|
|
|
|
Jeremy Falcon wrote: Does anyone else think coding interviews are fundamentally broken? Perhaps, but of the ones I've partaken in, it may also be me. With three decades under my belt, there's not much I can't do, yet I feel totally inept when asked "How would you solve" questions.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I think after years you become so focused on real problems and real solutions, that such out-of-the-world questions are irritating you so much you not even feel to do a real effort...
You take it as an insult to your developer intelligence
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|
|
I must agree with this sentiment.
Jeremy Falcon
|
|
|
|
|
Here's the problem:
Most people involved in hiring, (HR and managers), wouldn't recognise talent if the candidate had it tattooed across their forehead. So they resort to 'mechanical' methods of selection. If anywhere needs the help of AI, it's recruitment - because the real stuff isn't in abundance!
|
|
|
|
|
This isn't an anti-management or anti-interviewer thing. I've been in management. I've hired people. More developers need to understand the other side of life before casting judgment.
Anyway, my recruiter was awesome. The interviewer was great too. Super friendly and knowledgeable. It was a great experience, just broken in the way we go about it.
Jeremy Falcon
|
|
|
|
|
Btw, I do agree that a lot of recruiters and HR only go for the buzzword bingo game... but in this instance the recruiter was fantastic.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: Anyone else agree this is fundamentally broken?
Yes. For experienced folks, just a problem solving should not be the one to decide. It could also be an off day not just unable to answer exactly as the interviewer is expecting.
|
|
|
|
|
To be fair, putting arbitrary things at the bottom of the pile is a pretty important task for companies these days so it's no wonder they want to know you're good at it.
|
|
|
|
|
True... I could see that for sorting say notifications on the frontend, but 9 times out of 10 you'd use a method like Array.protoype.sort() rather than roll your own. Point being, for most LOB applications... we don't have to re-invent the wheel.
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: we don't have to re-invent the wheel.
That is probably the correct answer. Any good programmer will reuse (or, at least, get good ideas from) code that has been proven reliable rather than creating something new that may contain bugs.
|
|
|
|
|
jsc42 wrote: rather than creating something new that may contain bugs. Exactly
Jeremy Falcon
|
|
|
|
|
Jeremy Falcon wrote: Anyone else agree this is fundamentally broken?
Yes. The answer that I gave some folks a couple years ago was "Please don't ask me questions I can google the answer for."
There was a few seconds of silence.
The question they asked me was something along the lines of "what's an abstract class?" Seriously? I've been programming for 40+ years and you ask me that???
Marc
|
|
|
|