OVERVIEW ON LIBEREUM PROJECT

It was a friend of mine that shared this great opportunity with me- The libereum project; one of the most ambitious and well thought crypto currency project that I have personally seen in this…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Why do we need to ask for implementing Power function in interviews

In my current stint at Amazon, I have the opportunity of taking interviews for the SDE 2 position. SDE 2 are supposed to have 3–5 years of experience and well versed in the concepts of design and programming. So one would assume writing the power function should be a walk in the park for an aspiring SDE2 candidate. But after taking a good number of interviews I realise that the assumption is so not true.

So let me break it down here for the fellow aspirants.

The default response has been, “Hey, we can write a for loop to do this”. It seems like an innocent statement but it tells me so much about the candidate.

When asked to implement the function a typical response would be

Which is a major turn-off as no edge cases have been handled. No thought has been given to negative numbers or the input’s being 0. Let alone the mediocre complexity of O(n). Also, this function will break with even when called with small inputs for eg. power(2, 20) as it will exceed the integer limit in Java.

One would expect a student to be able to write this function yet there are people with 2–8 years of experience in writing code, who fail to think of the basic details that goes into writing code. This question has helped me filter out so many incompetent candidates that it has become my default opening question.

As I was googling this phenomenon I found that plenty has been written on this subject. There is a whole class of problems known as the FizzBuzz test which are nothing but basic programming questions. A brilliant post I found on this subject was by Jeff Atwood

My advice to fellow programmers would be to take some time before jumping into writing the solutions. The interviewer is there to have a conversation with you, ask some questions, get the problem statement clarified, take some more time. Discuss the approach, see if it is covering the corner cases, ask if the scope and quality of approach good enough. Finally, when you think the conversation has reached a point where you know all the details, proceed with writing the code.

Add a comment

Related posts:

What is Blockchain?

As we are getting ready to release our cryptocurrency mining simulation game Blockchain Tycoon, we’ve decided to talk about the cryptocurrency and mining process. This week we’ll talk about the…

Downtown YK death ruled not murder but alcohol poisoning

A murder charge related to a death at a downtown Yellowknife sobering centre has been downgraded to assault causing bodily harm after new evidence was received from the coroner’s office. Jerry…

What Is the Future of Psychedelics?

A few days ago I scrolled past a peculiar ad. I’m never sure what exactly the Instagram algorithm gods have in store for me, but here I was, staring into the void of what my micro-dosed brain could…