Live data from Hacker News

A software engineering interview question I like: computing the median

krisshamloo.com

91–97 of 97 posts

Re: A software engineering interview question I like: computing the median

#91
post #79

I don't know... I've been coding for ~30 years, and I've never had to write code to compute the median so it doesn't seem that useful unless it's somehow relevant to the job

Psychologists have been saying for ages that a good job interview is a small version of what the job requires them to do. But as always with most professions with people (and hence ego) involved, these people either mimic what the trending company in their sector does or test irrelevant academia knowledge. Maybe for such changes to happen the whole profession to go down a notch in prestige. Not sure if people can sto…

[dead]

Re: A software engineering interview question I like: computing the median

#92
post #70
post #40

> Right out the gate: the numbers must be sorted. But they don't. I hope you, as an interviewer, have the grace to learn when one of your interviewees points out your mistake. :-) Median is O(n), not nlogn

Can you please make your substantive points neutrally, without being a jerk? There's no need for the latter, even if you're 100% correct.

Sorry - I really wasn't trying to be a jerk, but I do acknowledge that directly addressing the author is aggressive.

I was mostly trying to emphasize the importance of avoiding the negative experiences of people interviewing when the interviewer was wrong about something and won't flex, as exemplified in a couple of comments in this thread:

https://news.ycombinator.com/item?id=48839767

https://news.ycombinator.com/item?id=48840261

So to clarify my point in a more general way: We _all_ have some concepts wrong in our head, and we should all strive to be not only graceful but delighted if an interviewee is correct when we're wrong.

Re: A software engineering interview question I like: computing the median

#94
post #2

In addition to the points listed, it gives the algorithm nerds the opportunity to show their overqualification by whipping out the O(n) median algorithm and proving that it works in linear time.

Or do a bucket sort on 32bit integers for worst case O(n) time, not O(n^2) Only half kidding… Using just 16GB RAM for a task is practically resource-constrained programming these days…

Just do four bucket sorts, once on each byte of the 32-bit integer. (Bucket sorts are stable sorts.) I benchmarked this and it was faster than quick sort.

Re: A software engineering interview question I like: computing the median

#95

Huh, feels overly simple to me. How about something like the beginnings of a spreadsheet engine? Or.. count the number of distinctly shaped black regions in a bitmap image.

My front end interview question is "ping this api and display the response on the page. Add a button to ping again and replace the data on the page with the new response."

This filters out approximately 80% of "Front End Engineers" in their framework of choice.

Re: A software engineering interview question I like: computing the median

#96
post #92
post #70

Earlier quoted context omitted.

Can you please make your substantive points neutrally, without being a jerk? There's no need for the latter, even if you're 100% correct.

Sorry - I really wasn't trying to be a jerk, but I do acknowledge that directly addressing the author is aggressive. I was mostly trying to emphasize the importance of avoiding the negative experiences of people interviewing when the interviewer was wrong about something and won't flex, as exemplified in a couple of comments in this thread: https://news.ycombinator.com/item?id=48839767 https://news.ycombinator.com/it…

I appreciate the reply! and yes, that's a much better way to express the point.

(Btw this is an interesting phenomenon - I call it the rebound effect: https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...)

Re: A software engineering interview question I like: computing the median

#97

This question, and many "but make it a bit more challenging!" comments always strike me as CS101 navelgazing type questions. The best part of this question is that it is simple and can be used to swing into deeper concerns but it is still at odds with actual job responsibilities - even more so with LLMs in the mix. Maybe this is because I have only worked at startups, but I am much more interested in if someone can r…

> There are far too many corners of logic for everyone to know. Maybe someone has never dealt with data streams, or even forgets what a median is.

Bad interviewers expect candidates to know things. I don’t. It’s okay for a candidate to have never worked on data streams or to forget what a median is. I simply provide the definition and continue. I care about the quality and effectiveness of thinking. If the candidate can be given a definition and then immediately turn that into code, that already shows that they are good at logical reasoning. It’s basically the same kind of thinking required when there is an urgent request at a startup and an engineer is pulled in to come up with a solution quickly; all the business logic will be new and you want someone who can learn quickly, internalize quickly, and produce results based on these learnings quickly. Therefore in my opinion asking these interview questions are actually a good indicator of how they will perform in a hectic startup environment.

Post reply on HN