A Monotone Priority Queue is neither sufficient nor needed to solve this problem (as it does not give a linear time solution). Instead the proper solution just needs a deque, see http://techieme.in/maximum-element-sliding-window/ . So yes as you can see knowing algorithms is important, as if you don't you will attempt to use an overly complicated data structure to come up with a suboptimal solution.
The solution using double ended queue is often referred to as monotonic queue, because queue content will be monotonic sequence.
Ask HN: Is asking obscure algorithms any test of programming ability?
31–40 of 43 posts
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#32I was recently asked to calculate the fibonacci sequence value in an O(log n) time complexity. I had no clue how to do it and explained that I can solve it in O(N) easily but don't even know how to approach the O(log n) method. I knew there must be some trick using factors but didn't even know how to start the problem. I looked it up later and one of the ways is using matrix multiplication (an implementation I still…
http://mathworld.wolfram.com/BinetsFibonacciNumberFormula.ht...
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#33Here's what happened to these companies: - They started asking algos and datastructs in the 00s because not too many people had the resources to study it. This served as a proxy for intelligence and was vaguely related as compared to other IQ tests or puzzles - In this decade, more and more CS graduates and bootcampers started studying the same algo and datastruct problems - Unable to reject anyone (because everyone…
Instead, the "nerd show off event" exists for one reason "see how much you want to work at that company". Since the realities of software development means the bulk of the engineers will probably be working on some small part of an unglamourous project, yet the "big 4" still want a monopoly on the best and the brightest, the interview process exists as a very targeted test to find people willing to jump through hoops. At this point the broad strokes of what is required is a solved problem, you just need to spend several weeks/months studying up on errata. The thinking is, any candidate willing to do that will be willing to spend several years working on CRUD interfaces for adsense or refactoring old php.
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#34Here's what happened to these companies: - They started asking algos and datastructs in the 00s because not too many people had the resources to study it. This served as a proxy for intelligence and was vaguely related as compared to other IQ tests or puzzles - In this decade, more and more CS graduates and bootcampers started studying the same algo and datastruct problems - Unable to reject anyone (because everyone…
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#35Here's what happened to these companies: - They started asking algos and datastructs in the 00s because not too many people had the resources to study it. This served as a proxy for intelligence and was vaguely related as compared to other IQ tests or puzzles - In this decade, more and more CS graduates and bootcampers started studying the same algo and datastruct problems - Unable to reject anyone (because everyone…
I think you've missed an important step in how these systems are used at these companies and how their funnels work. For a comapny like Google, their funnel is so tight by the time a candidate is onsight it's known that they're capable. Instead, the "nerd show off event" exists for one reason "see how much you want to work at that company". Since the realities of software development means the bulk of the engineers w…
In other words, they want people who'll work for them without complaining. Submissive people. People who won't think out of the box.
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#36But the more obscure stuff doesn't demonstrate much, really, except that they know obscure stuff or are good at researching to find solutions. A more effective question might be: develop or use an algorithm (no constraint on performance like here) to solve problem X. Then follow it up with discussions on how their solution performs and see if it can be improved, and how well they handle being directed to a better--more efficient--solution if they didn't pick an optimal one already.
Of course, even that has problems (with the second part having an implicit bit of "culture fit" to it, and depending on the interviewer being a good critiquer and not merely a nitpicker). And it still only reveals the ability to program-in-the-small. So would only be useful for certain roles, or perhaps more widely for entry level employees.
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#37Here's what happened to these companies: - They started asking algos and datastructs in the 00s because not too many people had the resources to study it. This served as a proxy for intelligence and was vaguely related as compared to other IQ tests or puzzles - In this decade, more and more CS graduates and bootcampers started studying the same algo and datastruct problems - Unable to reject anyone (because everyone…
I think you've missed an important step in how these systems are used at these companies and how their funnels work. For a comapny like Google, their funnel is so tight by the time a candidate is onsight it's known that they're capable. Instead, the "nerd show off event" exists for one reason "see how much you want to work at that company". Since the realities of software development means the bulk of the engineers w…
Would you say that Apple or Microsoft are any different?
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#38Earlier quoted context omitted.
I think you've missed an important step in how these systems are used at these companies and how their funnels work. For a comapny like Google, their funnel is so tight by the time a candidate is onsight it's known that they're capable. Instead, the "nerd show off event" exists for one reason "see how much you want to work at that company". Since the realities of software development means the bulk of the engineers w…
You are right. In other words, they want people who'll work for them without complaining. Submissive people. People who won't think out of the box.
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#39Earlier quoted context omitted.
You are right. In other words, they want people who'll work for them without complaining. Submissive people. People who won't think out of the box.
That's a scary thought to me. One that's probably correct, but scary, especially at companies who claim to champion "outside the box" thinking. It's almost like a sort of "Do as I say, not as I do."
Re: Ask HN: Is asking obscure algorithms any test of programming ability?
#40No it's stupid. Like asking an iOS engineer a question involving a tree data structure. It is stupid and irrelevant because at the end of the day our job is to build products/features. If you think at a student level you will never learn anything past college. Companies think that by default everyone can write code and build product. So they focus on stupid obscure stuff. I believe it's the opposite. We all went to c…