Live data from Hacker News

Python coding interview challenges

github.com

91–100 of 252 posts

Re: Python coding interview challenges

#91
post #61

Earlier quoted context omitted.

> I'm a kick-ass get-things-done full-stack web engineer. And modest, too. If an engineer gave me your answer ("I never learned the principle because I never had to") I would know they aren't a fit for my team.

> If an engineer gave me your answer ("I never learned the principle because I never had to") I would know they aren't a fit for my team So we should learn all the things, ahead of time, just in case we get an interview question at some point in life?

As an engineer you should be able to see the global picture and know other things. Because you wont be able to use something to solve your problem if you don't know it in advance. I mean, you don't need to know the details, but you need to know how things works.

For example, you might not need an AVL tree in your daily job, but if one day you need it to use it, you wont be able to notice if you don't know what is an AVL tree and what is its advantages over other trees.

Another example, you don't need to know http1 and http2 differences for your daily work. But if you know them you will change how you do web pages and you will see a leap in terms of performance and scability. And that knowledge also includes some knowledge about TCP, UDP, cache and other stuff.

Re: Python coding interview challenges

#92

I see these challenges as a great way for excellent experienced developers to weed out incompetent companies. I'm a kick-ass get-things-done full-stack web engineer. I've never had to deal with one of these sorts of problems in my day to day work; and if I did, I'd just find an existing, tested, stable library that already handled them. A company that needs someone to solve these sorts of problems doesn't want me on…

Most programmers on the market don't have a lot of experience, due to the programmer population increasing in size quickly over the last decades. (https://en.m.wikipedia.org/wiki/Population_pyramid)

So one big question all companies have is how to interview for programming positions by kids fresh out of school or who've had a job for at most a couple of years.

This is less a question of competence and more a reflection of the age structure of the market for programmers. You will be working with people younger and less experienced than you. You will probably be hiring people younger than you -- how will you interview them?

As someone with a couple decades professional experience, I see these challenges as one of many ways for competent companies to attempt to find competent programmers despite a lack of experience by the interviewee.

The last company I interviewed for gave me coding challenges, but that's not all they asked, I got plenty of questions that allowed my experience to shine. If you only got coding challenges as an experienced developer, then yes, that would be a reason to avoid that company.

On the flip side, my willingness to take the coding challenges in my interview allowed me to highlight my practical experience, because I crushed them with little preparation. Other experienced devs who refused the coding challenges or dragged their feet and complained about them lost the opportunity to receive an offer.

Re: Python coding interview challenges

#93
This is great! Having an integrated environment with the tests included and solutions in a separate notebook is quite valuable for training to pass technical interviews.

I see a lot of people posting about how they dislike the technical interviewing process. The sentiment seems to be that for a certain class of popular developer role it's entirely unlikely that they will ever need to remember how to implement a heap or red-black tree to be effective at their job... so why use problems like this in an interview?

I think these sorts of questions should be used by teams that want to set the minimum standards on the team. I'm reminded of a rule used at the Recurse Centre: never feign surprise when someone asks a question (I paraphrase). The idea is that if someone asks you a question about something you think is fundamental, like Bash for example, don't immediately feign surprise and say, "You don't know bash?" It's not helpful. Instead take it as an opportunity to teach them something awesome. However this doesn't generally work in a professional setting where you're required to know Bash in order to function at your job.

If on my team we're responsible for the operation and maintenance of several millions of dollars worth of infrastructure that runs our customers' applications then there are certain minimum requirements for operating effectively within this team. I expect you would know Bash at a minimum. I should also expect you to know the network stack of the OS we deploy on, how TCP works, what a hypervisor is, etc. We may write most of our application code in a high-level language that abstracts these details away but that doesn't preclude you from understanding them. It's just a convenient tool. You have to know how to manage complexity and avoid premature pessimization in order to be effective and that means you will be interviewed using technical questions to screen for that minimum level of knowledge.

However I think most companies do tend to use this tool poorly. I've interviewed with startups that build consumer web applications that ask questions about radix sort and k-d trees. That's what I call, overkill. This trap is easy to fall into if your motto is something glib and banal like, "We only hire the best." If you don't quantify what "best" is you're just going to negatively filter out potential candidates and hire on bias. You have to scale the screening process to only test for that minimum competency and choose how much risk you want to take in teaching new hires.

If I'm hiring a more junior developer to our team I expect that we're going to mentor that person and make them a better engineer by working with us. They can ask questions that may be outside of our minimum standard. However if I'm hiring for a team-lead position I'm much more likely to not accept a candidate who cannot fly through our screening process. Working with them is going to be difficult and if it's 3 in the morning and they're causing more problems than fixing because they don't know how the TCP re-transmission protocol works then we're going to have a problem.

The conclusion of all this is: tweak the screening process to set the minimum standards required for effective communication on the team. Don't set the bar unnecessarily high: define what the bar should be and assess the risk of mentoring junior developers. You need a good mix across the spectrum for an effective team.

Re: Python coding interview challenges

#94

Earlier quoted context omitted.

sum([5,6]) ?

log(exp(5)*exp(6))? Guess that won't work too well with larger numbers...

It breaks quite early:

    In [8]: math.log(math.exp(5000) * math.exp(6000))
    ---------------------------------------------------------------------------
    OverflowError                             Traceback (most recent call last)
     in ()
    ----> 1 math.log(math.exp(5000) * math.exp(6000))

    OverflowError: math range error

    In [9]: math.log(math.exp(500) * math.exp(600))
    Out[9]: inf

Re: Python coding interview challenges

#95

In a way I prefer this to "how many ping pong balls can fit in a school bus" that was all the rage in the 90s and early 2000s. But... man... I have a computer science degree, I've been coding for 20 years, and I've held (and kept) a CTO role at two mid-sized startup companies. Currently I'm considering looking for a job at a larger company (where I wouldn't be CTO but I'd be hopefully paid more) and these kind of que…

Personal opinion but I think "how many ping pong balls can fit in a school bus" is not that bad.

I've asked HR people why they ask that question, and it was not to have a correct answer but to demonstrate your train of thought.

When I give a coding interview, I will use more development oriented questions but I want to see HOW they get to the answer, not the fact they memorized an algorithm that just so happened to be on the coding test.

Re: Python coding interview challenges

#96

In a way I prefer this to "how many ping pong balls can fit in a school bus" that was all the rage in the 90s and early 2000s. But... man... I have a computer science degree, I've been coding for 20 years, and I've held (and kept) a CTO role at two mid-sized startup companies. Currently I'm considering looking for a job at a larger company (where I wouldn't be CTO but I'd be hopefully paid more) and these kind of que…

If you've got that much experience and someone asks you how to impliment a linked list, I'd say you should politely leave the interview. Graduate questions like that are insulting once you've got past the junior levels, as companies asking them are either too lazy to put a proper interview together for more senior levels, or not senior enough to know the difference.

That's not to say they can't ask you about data structures, but they shouldn't be asking you to code them up from first principles if it's something the language can do for you.

I find it much more fruitful to have a technical chat with candidates instead of being dogmatic about asking toy questions. It's pretty obvious when someone doesn't know what a linked list is with a 30 second chat. Heck, even drawing a few boxes and arrows on a napkin will suffice.

Re: Python coding interview challenges

#97

I don't understand code challenges. Can you even program without Google and Stack Overflow anymore? And god-forbid being experienced in a dozen frameworks and libraries if it's not the exact combination the company uses.

Every company that has challenged me with a datastructure/algorithm coding challenge (not pseudocode whiteboarding) has given a full description of the algorithm and allowed googling of basically anything except "AlgoX implementation in Langlang"

Re: Python coding interview challenges

#99

Earlier quoted context omitted.

I primarily write python web-based APIs for a web application + 2 mobile apps. Just the other day, I was dealing with an endpoint that had to update hierarchical data (i.e. a collection of trees). Due to the circumstances, normalization wasn't an efficient option. I ended up throwing together a barebones tree with a 5-line DFS implementation to traverse it. It handled inserts, updates and deletions (for my use-case)…

And because your code was implemented in python (rather than use prebuilt libraries that call back to C) it was 100x slower than it should have been. Im all for knowing the fundamentals but there is a strong argument for knowing the right tool for the job.

And because it was attached to a web api, it was likely still io bound, so it didn't matter.

Context and knowing the right tool for the job is important indeed.

Re: Python coding interview challenges

#100

Earlier quoted context omitted.

log(exp(5)*exp(6))? Guess that won't work too well with larger numbers...

It breaks quite early: In [8]: math.log(math.exp(5000) * math.exp(6000)) --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) in () ----> 1 math.log(math.exp(5000) * math.exp(6000)) OverflowError: math range error In [9]: math.log(math.exp(500) * math.exp(600)) Out[9]: inf

Hey let's not be a quitter

    >>> (Decimal(5000).exp() * Decimal(6000).exp()).ln()
    Decimal('11000.00000000000000000000000')
Post reply on HN