I would not have though to use this formula. The sum of the integers grows as the square of n so if n is anything but small you will overflow and get an erroneous answer. This interview question has everything bad imo: no practical uses, test knowledge of math formulas (which every math/CS major would have but none of the self learning folks). It’s very easy to stress and fail when given such a test, and even already…
> I would not have though to use this formula. The sum of the integers grows as the square of n so if n is anything but small you will overflow and get an erroneous answer. As long as you can get wraparound semantics, the overflow is actually unproblematic. (n(n+1)/2 + k) mod 2^32 - (n(n+1)/2 mod 2^32) = k mod 2^32 = k.
I cheated on my Microsoft interview (2019)
81–90 of 503 posts
Re: I cheated on my Microsoft interview (2019)
#82Re: I cheated on my Microsoft interview (2019)
#83The question is very unrealistic... how often do you know there is exactly one duplicate in a list? Much more common is there are zero or more duplicates. Here is what I came up with: - We need a way to record what has been already seen - A hash-map could work, but I think we can be more efficient - We know that all elements are less than the array length in size... - So we can allocate a single array of flags with t…
Also, your way is O(n) memory when O(1) would be enough for the original question.
Re: I cheated on my Microsoft interview (2019)
#84Earlier quoted context omitted.
This guy is one of those LinkedIn thought leader types prone to oversharing for attention.
That's harsh because TFA does mention that they feel outright uncomfortable (even after 18 years!) how big a role luck played in them clearing that fizzbuzz interview question: > I've struggled with this a lot over the years, but I finally decided to share my story. I don’t think I would have made it past the first round of interviews at Microsoft if I hadn’t gotten so lucky. So pretty much, my entire career is built…
Also, as someone who's been tested with this kind of questions (in the math and physics fields at least), I realized many times you aren't evaluated for knowing the answer but for how you go about trying to find it even if you fail.
This particular question is close to my heart as I was tested with it as a pupil in school. The teacher wrote this on the blackboard and asked me to come over and solve it (not having any prior knowledge). After a bit of fidgeting with the chalk I stared writing on consecutive lines 1, 1+1, 1+1+1 and after a few lines it dawned on me it looks like the "lower" half of a square of side n as cut by its diagonal. So I proudly concluded that the sum is n^2/2. Which was of course wrong, I forgot to add an n/2 to that since the "diagonal" is shifted right a bit. Still got top mark and maybe it was one of those moments that set me on a path. This went on through high-school, university, post graduate studies, and early career. It was only when I was knee-deep in real work that people started to care less about how I think and more about just the end result.
Preparing for this kind of question isn't cheating as long as you understood the answer.
Re: I cheated on my Microsoft interview (2019)
#85Earlier quoted context omitted.
The explanation of the name somehow is a lot better than what I assumed it was referring to. The phrasing on the second sentence is... unfortunate.
I’m referring to the easy looking, tricky to solve problems. I’ve heard them referred to by that term because they have been used at Moscow University to discriminate against Jewish students but I don’t know if they have other names. There is some discussions and examples of such problems at https://arxiv.org/pdf/1110.1556.pdf and http://3038.org/press/shen.pdf .
Re: I cheated on my Microsoft interview (2019)
#86Earlier quoted context omitted.
That’s a very elegant solution. Hard looking problems that had simple, trick solutions were called Jewish Problems at the entrance of some universities. This would let the examiner fail a student for subjective reasons instead of academic success. The examiner would then be able to say « I failed them because of their skills, not because of their religions, look how easy the solution is ». Perhaps this is what we are…
The explanation of the name somehow is a lot better than what I assumed it was referring to. The phrasing on the second sentence is... unfortunate.
It's like saying the phrasing on the Chinese Exclusion Act is unfortunate. It's not the phrasing that's unfortunate, but the history of excluding Chinese. These questions were designed to allow screeners to discriminate, and were named after the group designed to be kept out.
edit: If you edit a comment in response to a response, it's polite to say [edited]. Otherwise, the conversation is a non-sequitur, which seems to be happening here a bit.
Re: I cheated on my Microsoft interview (2019)
#87Earlier quoted context omitted.
Using 64 bit integers, we can store the square of any 32 bit integer. Not that small...
Also it was 2004 and 64 bit machines weren't common. If I remember correctly you had only 2 GB available under Windows XP and if you wanted more, 3 GB to be more precise, you had to boot with a special parameter.
Re: I cheated on my Microsoft interview (2019)
#88I'm surprised that atm there is a consensus in the comments saying that it's not cheating. Companies ask interviewers to not reveal the questions they had to other candidates. It's likely that his friend was told not to say that. Overall he clearly had an unfair advantage, and even if legally it wouldn't be the definition of "cheating" it would go against the intent of the interview: which is to evaluate candidates i…
I'm shocked too. Comapre it with people who applied too, but didn't have that "internal" knowledge Is it fair from that "not well networked" person perspective? It's not even like he found this question randomly on the internet, he got it from MSFT employee, lol. I have really mixed feelings about this Edit. Don't get me wrong, apparently author was(and is) capable of doing his job, so it isn't a big problem, but wha…
Than Microsoft would've been scammed out of $350 worth of plane tickets, $150 worth of hotel commodations and $1000 worth of employee time. Hardly the end of the world for a multi billion dollar company
> and passed just due to the advantage?
Passed a six hour Microsoft on-site grilling due to knowing the question for a 15 minute off-site interview question?
Re: I cheated on my Microsoft interview (2019)
#89Ethics are foundational to engineering. Jettisoning them is a sign of a discipline in decline.