6 ms·
> So there's not a lot that you can do, but just familiarize yourself with algorithms and ways to solve common problems and write plenty of code. :) I'd prefer
by zepolen 4y ago
> So there's not a lot that you can do, but just familiarize yourself with algorithms and ways to solve common problems and write plenty of code. :)
I'd prefer someone that can infer the algorithm without knowing it before hand than someone who just memorized a bunch of them.
- KronisLV 4y agoAfter solving problems like that for years, eventually almost anyone will develop such an ability, like one also would in regards to DB schema design, system design and picking architectures/design patterns. The problem is that the majority of people simply don't spend time on issues like that, either in their day jobs or weekends/evenings. The closest you can get to things like that if you work in pretty boring domains, is having to pick between a Set or a Map for some data structure in the app. Or avoiding things like N+1 issues which have relatively little to do with algorithms and more in regards to how frameworks implement things.
- CorrectHorseBat 4y ago>I'd prefer someone that can infer the algorithm without knowing it before hand than someone who just memorized a bunch of them. Can someone do the latter without the former?
- whitesilhouette 4y agooh yes you can, so long as you don't equate _memorizing_ things with _knowing_ things.
- hgsgm 4y ago
- CorrectHorseBat 4y agoNot equating, but requiring. Can you really know something you didn't memorize? I don't think so.
- whitesilhouette 4y agoOf course I can. I never memorized the link to this thread but I know how to find it.
- hgsgm 4y ago
- erganemic 4y agoComing up with algorithms on the spot isn't a viable strategy for technical interviews any more, even if you're a super-genius. Here's a question that the page author claims took Donald Knuth 24 hours to solve [1], which is classified on Leetcode as a Medium(!) difficulty question [2]. Leetcode Medium questions are typically the cut-off point for most FAANG-tier interview questions--and while this is a hard medium, I know someone who got a variation of it at a Meta interview, and was expected to solve it in 30 minutes. So unless you're 48 times faster at inferring algorithms than one of the best algorists in the world, memorizing tricks is the game you have to play if you want a FAANG-adjacent job! Of course, then the natural reaction is "if your hiring process would pass on Donald Knuth, your hiring process is broken," which is absolutely true, already known, and (apparently) deemed acceptable. [1] https://keithschwarz.com/interesting/code/?dir=find-duplicate https://keithschwarz.com/interesting/code/?dir=find-duplicat... [2] https://leetcode.com/problems/find-the-duplicate-number/ https://leetcode.com/problems/find-the-duplicate-number/
- zepolen 4y agoFAANGs would pass on Donald Knuth, their entire process is made to find devoted soldiers who will memorize every algorithm and sit through 10 interviews and are too naive to think for themselves. Corps want to say "Do this, fast, using what you know" and the candidate says "Right away!". Knuth on the other hand would say "Hold up, there might be a better way, screw the deadline, I'll find it". Corps don't want that.
- vitiral 4y agoThat problem is a terrible interview question, mainly because it's completely trivial with O(n) memory (just use a Set), but requires a different branch of comp sci at O(1). Personally I also feel that any question that needs an O(1) memory when you _start with an array_ is disingenuous. O(1) memory was used for things like tape storage, where N was some huge external storage. If you already have an array, then the chance you don't have double that memory are dibcus.
- sanedigital 4y agoNot sure I agree. It's very simple if you look at what's "wrong" with the input: it has a duplicated number, which means there's a "right" version of it without. That right version is just the count from 1->n. Once you see that, you can see that all you have to do is sum each list and calculate the difference.