11 ms·
Hexing the technical interview (2017)
- hprotagonist 7y agosee also https://aphyr.com/posts/342-typing-the-technical-interview https://aphyr.com/posts/342-typing-the-technical-interview and https://aphyr.com/posts/340-reversing-the-technical-interview https://aphyr.com/posts/340-reversing-the-technical-intervie...
- wpietri 7y agoAphyr is a joy and a wonder: “If it were meant to be illegal,” you remind him sagely, “Sun Microsystems would have made it unrepresentable.”
- tptacek 7y agoOne will be the fast iterator. Her name is Jorunn, and her legs are strong from years of skiing.
- freshhawk 7y agoI'm still convinced that the "Clojure from the ground up" series [1] is the best and most effective language guide/tutorial I've ever read. The level of understanding at play there, in terms of building the correct mental models in the right order for a broad audience is excellent. [1] https://aphyr.com/tags/Clojure-from-the-ground-up https://aphyr.com/tags/Clojure-from-the-ground-up
- aidenn0 7y agoCan anyone tell me if there is a specific work Aphyr is referencing with the narration style?
- closed 7y agoThe style of this series reminds me of the book, "Excercises in Style", which is the same short (2 page) story told in 99 different writing styles! (Not sure about the style of this individual story) https://en.m.wikipedia.org/wiki/Exercises_in_Style https://en.m.wikipedia.org/wiki/Exercises_in_Style
- hcs 7y ago...which in turn reminds me of Exercises in Programming Style, which I have been meaning to read through: https://github.com/crista/exercises-in-programming-style https://github.com/crista/exercises-in-programming-style
- ddevault 7y agoHe also appears to reference His Dark Materials, which is my personal favorite book (or trilogy, but they're one work).
- freshhawk 7y agoThere is definitely some His Dark Materials (hey, the new show seems to be doing a decent job of adaptation! I was so nervous) references in there. Is the wrist scar reference from the series and I've forgotten it or is this from something else?
- ddevault 7y agoHm, the wrist scars don't remind me of anything in particular. He later clarifies that the scars make out the letters HJKL around his wrist - so maybe it's just a gag for that reason.
- freshhawk 7y agoThat is probably right, found this [1] comment where he explains it. I thought the torus/ice stuff was a Jemisin reference! [1] https://www.metafilter.com/166166/Og-to-til-javanissen#6985515 https://www.metafilter.com/166166/Og-to-til-javanissen#69855...
- aidenn0 7y agoSomeone else posted the answer straight from the horse's mouth: https://www.metafilter.com/166166/Og-to-til-javanissen#6985515 https://www.metafilter.com/166166/Og-to-til-javanissen#69855...
- shpongled 7y agoWow, I've never seen this before. Love the writing style - reminds me of trying to put together things like this in a creative writing class.
- loeg 7y agoIf you like this you'll love his twitter.
- tines 7y agoI wish I could write like this.
- kick 7y agoYou definitely could: writing ability comes with practice, just like programming ability. I recommend trying to get a solid pace with it!
- saagarjha 7y agoI’d probably be too embarrassed with the intermediate results…
- kick 7y agoYou don't have to publish them immediately; when it's only you reading your writing, you might feel embarrassed, but no harm or loss of status will come to you, so you absolutely should at least give it a try!
- solveit 7y agoGood. That means you have good taste and can therefore improve.
- winter_blue 7y agoYes, this exactly. I read somewhere that being able to recognize that your work is not great (yet) is sign that you've got good taste. And it's that taste that gets you to place where you're able to produce amazing work.
- fenwick67 7y agoIra Glass's take on this is so good and I go back to it often when my creative work is less than satisfactory: https://www.youtube.com/watch?v=X2wLP0izeJE https://www.youtube.com/watch?v=X2wLP0izeJE Basically when you work on creative stuff you're drawn to it because you have good taste, but for a long time your work will disappoint you because of your good taste.
- bytematic 7y agoIncredible, every line is well-thought-through
- TurkishPoptart 7y agoI wish I could understand what's going on in this article. Besides a magical Swede impressing some normie in a hoodie.
- saagarjha 7y agoHe’s writing Java bytecode to implement Floyd’s “tortoise and hare” cycle detection algorithm for a linked list.
- TurkishPoptart 7y agoI know some of those words.
- saagarjha 7y agoHopefully by the end of today you can know something about all of them!
- taurath 7y agoTortoise and hare agorithm is an interesting one to look up. You’ll never use it in practice, but it’s clever.
- rkangel 7y agoAnecdatum, but I've used it on an embedded target to check that datastructures loaded from flash didn't get corrupted.
- gknoy 7y agoWhen reading the story, I thought, "well of course that's the solution ...", but then couldn't recall ever learning it. I'm grateful that someone shared the name, as Wikipedia's explanation is surprisingly clear: https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_Tortoise_and_Hare https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_Tortoi...
- wenderen 7y ago
- geebee 7y agoI understood this was about finding a cycle in a linked list. I wish I could understand the code part. But the writing part was pretty brilliant. On another note, I only wish my technical interviews were so simple. People talk about weeding out those who can’t program but finding a cycle in a linked list is a prerequisite to the prerequisite for passing the google interview questions I was expected to do in 45 min at the whiteboard.
- saagarjha 7y agoFWIW, I don’t particularly like this interview question since it’s dangerously close to a riddle. Sorting, graph traversal, and other algorithms are well covered by undergraduate computer science curriculums, but this algorithm is basically impossible to come up with unless you know it already and it’s not even something that you would “know to know”…
- SamReidHughes 7y agoThere are other simple algorithms you could come up with that have the same big-O.
- saagarjha 7y agoI’d be happy to hear about them if you know any!
- SamReidHughes 7y agoTake the naive n^2 algorithm, but test only the nodes whose distance from the start is a power of two.
- saagarjha 7y agoThis seems just as magical as the original algorithm. Do you have insight as to why it works and what though process is necessary to arrive to it?
- ddevault 7y agoSee also (x4): https://hn.algolia.com/?q=hexing+the+technical+interview https://hn.algolia.com/?q=hexing+the+technical+interview (+2): https://hn.algolia.com/?q=typing+the+technical+interview https://hn.algolia.com/?q=typing+the+technical+interview (+1): https://hn.algolia.com/?q=reversing+the+technical+interview https://hn.algolia.com/?q=reversing+the+technical+interview But, as far as I'm concerned, these articles could be posted a dozen more times and it wouldn't be too much.
- wolf550e 7y agoThe author about the writing: https://www.metafilter.com/166166/Og-to-til-javanissen#6985515 https://www.metafilter.com/166166/Og-to-til-javanissen#69855...
- dang 7y agoAcing in 2017: https://news.ycombinator.com/item?id=13886626 https://news.ycombinator.com/item?id=13886626 Hexing a bit in 2017: https://news.ycombinator.com/item?id=14050017 https://news.ycombinator.com/item?id=14050017 Typing in 2017: https://news.ycombinator.com/item?id=14078852 https://news.ycombinator.com/item?id=14078852
- Fellshard 7y ago'typing' is one of my all-time favorites. It's pure magic watching him pop what I suspect are dependent types out of Haskell's type system, and that prose is just laugh-out-loud magic.
- tylerhou 7y agoDependent types are slightly different — dependent types depend on values. Since Aphyr is working entirely in the type system, there are no values. Aphyr is abusing Haskell’s type deduction feature.
- Fellshard 7y agoTrue, now it's coming back to me. It blends different orders of kinds (I'm still probably butchering it). The abuse makes sense in terms of the type system behaving as a logic / goal-seeking engine. It does showcase the truly impressive work going in behind the scenes of Haskell.
- hcs 7y ago> It blends different orders of kinds Orders, kinds, types, sorts, classes, groups, categories, genera, flavours, colors, shapes... same thing.
- mijoharas 7y ago> Orders, kinds, types, sorts, classes, groups, categories, genera, flavours, colors, shapes... same thing. Same thing, to first order.
- krick 7y agoIt's probably the 3rd time I've read this, and I'm loving it every time.
- winter_blue 7y agoThis is wonderful. I think Aphyr is going to displace idlewords as my favorite author.
- bitwize 7y agoOne would do well to keep in mind the third commandment of technology management: "Thou shalt not suffer a witch to live." A.k.a., nobody likes a smartass, regardless of how good they are. If you interview one, it's a no hire. If you're unfortunate enough to find out there's one on your staff, it's pink slip time.
- greesil 7y agoWhat if your non-conformer is heavier than a duck?
- jacobsenscott 7y agoSomeone is generally classified as a smartass when the balance of intelligence is on the smartass side. So this is just giving idiot managers carte blanche to fire people smarter than they are. For job security I guess.
- soVeryTired 7y agoNot sure I agree. I've worked with a few "smartasses" in my time, and it can be a real pain. Some people are absolute masters of the technical details of a subject, but fail to see the wider context. For example, you get developers optimising the hell out of a block of code - making it unmaintainable in the process - when the real bottleneck is developer time, not processor time. Or someone builds a giant vector autoregression model powered by MCMC when a rolling mean would have been adequate for the task. Build the simplest tool that will solve the task at hand is not a mantra that comes easily to some people.
- croon 7y agoDisagree. I've worked with smartasses, and I've worked with many people smarter than me. While there can be overlap, there generally isn't, in my experience. Smartassery is something I've most often witnessed in people having a need for self-assertion. Most really smart colleagues I've had are confident enough in their skills that they don't need to prove them by being smartasses. Anecdotes, but quite a few of them.
- 7y ago
- iLemming 7y agoAwesome. I've read it on my phone. Nice thing about Clojure - like any Lisp it doesn't care about the width of your screen, it wraps, yet retains readability. Who are all those people who constantly whine: "Lisps are unreadable". Dyslisplexic programmers?
- loeg 7y agoI can't tell if your comment is satire or just sincere Lispism.
- iLemming 7y agoNo, I'm serious. Lisp is incredibly fast to write, and (with a bit of practice) is amazingly readable. People foreign to Lisp often look at it and without even slightest attempt to give it a try, immediately reject it as "hard to read". But in reality, as I said - Lisp retains readability even on small screens, good luck trying that with literally any other programming language. The only drawback of Lisp syntax I can think of - probably it is not a very good choice for white-boarding interviews.
- pjc50 7y agoAll of those statements about Lisp would do better with the qualifier "for me". Lisp people tend to assume that what they can read most easily is most readable for everyone and that makes them dismissive of those who find it hard to read - and that dismissiveness counts against Lisp adoption. > Lisp retains readability even on small screens, good luck trying that with literally any other programming language I learned from Sinclair BASIC on a 32x24 character display on a black-and-white PAL television, as did a lot of people. Readability is highly subjective.
- iLemming 7y ago> dismissive of those who find it hard to read I've seen it multiple times - it's only the initial reaction, it doesn't usually take too long for anyone to adjust to the syntax. I have never met anyone who used a Lisp for several months and still hates it and finds it unreadable. I wouldn't count anecdotal encounters of people online, claiming for it to be mostly true. I have seen people using one Lisp e.g., Clojure and having difficulty quickly parsing a different Lisp dialect, e.g., EmacsLisp, but that's not "Lisp being unreadable," it's just unfamiliarity with specific language idioms. I had also seen people who learned Clojure before any other languages and then tried learning a non-lispy language (java, python, etc.) and surprisingly claimed it to be harder to read (initially). > that dismissiveness counts against Lisp adoption I agree, but how do you fix this problem? You can't remove parens and keep it homoiconic. Tools like Parinfer do help, but they don't address the problem: Lisp doesn't look "sexy" for those who are unfamiliar with it. I kept ignoring Lisp for many years, simply because I didn't know better. I wish there were people who'd keep telling me that parentheses are not a problem, they are a solution.
- ilovecaching 7y agoMy friend and I both work at FAANG. He told me a story once about how he wrote the solution for a whiteboard problem in Haskell. Once he was done the interview asked “great, so do you want to start coding this up?”
- staticassertion 7y agoAphyr is also the author of many Jepsen tests, such as this somewhat infamous case: https://aphyr.com/posts/284-call-me-maybe-mongodb https://aphyr.com/posts/284-call-me-maybe-mongodb Jepsen: MongoDB Aphyr is an incredible writer and just extremely smart, it is hard to read anything from him and not come away humbled.
- shaklee3 7y agoAphyr is the author of jepsen itself, and I believe all the tests as well.
- staticassertion 7y agoI thought that some others were contributing these days? I was aware that he was the initial author.
- OldGuyInTheClub 7y agoI didn't understand most of it but for some reason I have now installed Lisp and am working through a tutorial.
- Ill_ban_myself 7y agoHere, take your father’s parentheses.
- arthurcolle 7y agoElegant weapons From a more.... civilized age
- threatofrain 7y agoBug hunting is a complicated profession.
- zelly 7y agoThis was much more about Java than Lisp. It was just a really out-of-the-way way of writing Java. Clojure almost made me hate Lisp because of all the leaning on Java that's done as shown perfectly in this post. Actual Lisp is a lot more fun. Install SBCL, pick up a Lisp book from 30 years ago (e.g., Paul Graham's, Peter Seibel's, Norvig's), and start hacking.
- iLemming 7y agoWe can keep debating all day long how Java and Javascript suck, but the massive ecosystems based on these two suckers sadly won't go away anytime soon. There are of course languages that are more fun to work with, but at the end of the day we all have to eat. I would love to see Common Lisp's former glory to be restored, but sadly the language use in the industry seems to be shrinking every year. Clojure is a modern, practical Lisp dialect that lets me use real REPL and structural editing and at the same time keep my sanity intact, plus I get paid. Please don't be so harsh about it. I think having a Lisp as a hosted language was an awesome idea, I'd rather write (slightly crippled) Lisp that targets multiple platforms and get paid, rather than "hacking" in a (real) Lisp for free, or even worse - no Lisp at all.
- egypturnash 7y agoThis is beautiful, and horrifying. A cleverly written tale around some deep magic. And yet. Who among you would hire this witch? Who among you would want to maintain this kind of code, should this witch move on to challenges more suited to her skills? Who among you would dare to meddle with the work of a Real Programmer[1]? 1: http://www.catb.org/jargon/html/story-of-mel.html http://www.catb.org/jargon/html/story-of-mel.html
- vnorilo 7y agoI think anyone would be a fool to NOT hire her and NOT treat her like a dangerous, high energy combustible material.
- pjc50 7y agoIt should not be taken too literally. Part of the context is how asking this type of puzzle question with a simple expected solution is trivialising to smart programmers; part of it is the question of how many places cargo-cult difficult interviews because google do it that way but then expect people to work on CRUD apps with little originality or autonomy. It would indeed be a disaster to hire someone like this for that job. On the other hand, there are places where this kind of thing would fit right in: exploit writing, games development, certain kinds of HPC, cryptography, some firmware development. And it demonstrates the kind of deep understanding where being able to read this kind of thing is very useful to puzzle out some horrendous low-level mess that has been inflicted on you by a vendor. If it was John Carmack or Richard Feynman doing it, it would be celebrated. The risk with "rockstars" is they do this stuff when you don't want them to. Codewitches are much rarer, and have a much better sense of when it's a good idea. Neither is ever really going to be a "team player" but can deliver amazing things.
- solipsism 7y agoGuess I'll be one of the few to speak up and admit, I just don't get it. I'm sure I'll be downvoted for it by a dozen people smarter than me who resent my ignorance. The prose seems to resemble something dark and beautiful and meaningful. But if it's meaningful it's lost on me, for the most part. And dark and beautiful and meaningless is honestly a bit torturous. Like trying to stare at a Pollock and understand something. And the bytecode just couldn't be more boring to me. Why is bytecode for this mundane algorithm interesting? Someone could do us second class citizens (who I have no doubt are orders of magnitude more numerous than those who privileged few who get it) a favor by producing us with a line-by-line analysis. But I guess that would ruin the feeling of privilege.
- Aeolun 7y agoI don’t get anything about the code either, but the stuff around it is funny. I think it’s a bit funnier since I only understand half of it, which is exactly how the interviewer is supposed to be feeling.
- EliRivers 7y agoPut down your pre-emptive feelings of defensiveness. FFS, there's no shame in not understanding something. There is shame to be had in throwing around accusations of privilege at people who understand something you don't. People won't downvote you for not understanding. Some people will applaud you for saying you don't understand, up until the point they realise you're not seeking help in understanding, that you're not trying to improve your own knowledge and wisdom; that instead, you're trying to make yourself feel better by ascribing yourself some moral high-ground for not being one of those "privileged" people who understand something you don't. They might downvote you for being a passive-aggressive child about it.
- solipsism 7y agoSome people will applaud you for saying you don't understand I've been around enough to know how wrong that is. Do you actually believe this? Honest questions asking for explanation are almost guaranteed to result in a negative vote sum. instead, you're trying to make yourself feel better by ascribing yourself some moral high-ground for not being one of those "privileged" people who understand something you don't. Make myself feel better for what? Maybe I needed to include the /s tags...
- closeparen 7y agoHe's not kidding about the cafe babe in section 4.1. >The magic item supplies the magic number identifying the class file format; it has the value 0xCAFEBABE. https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1 https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.ht...
- xena 7y ago404
- mikorym 7y agoWhy are there so many hex numbers used? Are they pointers, variables, for calculation...?
- saagarjha 7y agoThey're raw bytes that are passed to the Java class loader.
- fulafel 7y agoIt serves the writing. "Hexing" has a double meaning, witchcraft and hexadecimal.
- pjc50 7y agoThey're raw Java bytecode, passed to the JVM for execution. Some of them are also variables or strings.
- mikorym 7y agoWhy does she do that? I would guess for performance. So you would be side-stepping some of the compilation?
- pjc50 7y agoI suspect in the end it's not much faster, but it is smaller. Really the fun in the essay is that that's not what any normal person would do as a solution to that problem, it's a stunt to show off deep mastery.
- mikorym 7y agoBut in this case, is it mastery? To me, mastery would be if you can use mathematics to trivialise an implimentation in a counter intuitive way. I understand that this is a different kind of mastery. But does the essay write code that is a sign of mastery, or does it just use the byte code as a talisman? I don't follow the code so I wouldn't know.
- Deestan 7y agoJust a tip for anyone wanting to write Norwegian words. O and Ø are different letters. You don't make a word more Norwegian by adding slashes over random Os. A coumparisoun would be to change "o" to "ou" tou make sentences louk moure English.
- iLemming 7y agoClojure is spelled with 'ou' in the UK. #truestory
- tshanmu 7y agowould be interesting to know if a reallife interview inspired this post! Tim - are you out there?
- oneepic 7y agoSlightly related, since this blog post has inspired me for a while. I would absolutely love to read a whole fantasy-themed "tome" that treats a programming topic as a school of magic. Maybe VR/AR is like illusion/alteration magic. Maybe robotics is the equivalent of summoning, or beast training, or something; maybe electrical engineering is like smithing or crafting. Computer history is lore. And so on... I wonder if there's anything else out there like this idea? If not, I'll make it happen.
- chronolitus 7y agoRa - Sam Hughes [https://qntm.org/ra https://qntm.org/ra] (honorable mention: Harry Potter and the Methods of Rationality - Eliezer Yudkowsky)
- sideshowb 7y agoNot a tome but I wrote a short story :) https://omnisplore.wordpress.com/2019/06/21/manifest-logic/ https://omnisplore.wordpress.com/2019/06/21/manifest-logic/ (sorry about the wordpress ads. ebook format avoids them) And then I wrote a list of other stories in this category (Ra, linked from sibling comment, is brilliant, by the way. Less programming oriented by the concepts do underlie the story). https://fiftysevendegreesofrad.github.io/hard-comp-fi-fiction-list/ https://fiftysevendegreesofrad.github.io/hard-comp-fi-fictio... You're welcome to send pull requests to the list with more reviews etc. Though it's drifing from my control - having started to read some Vernor Vinge I'm not sure he belongs on the list.
- jameshart 7y agoAgree - this style is so rich with possibility. I’m reminded also of the Young Lady's Illustrated Primer from Diamond Age, which included fairy stories that taught fundamental computer science. It also imagines a cultural upbringing where algorithms are the solutions to ancient riddles.
- acemarke 7y agoYou might be interested in Rick Cook's "Wizardry" fantasy series from around 1990. A Silicon Valley programmer gets pulled into a fantasy world, and ends up writing a compiler for his own Forth variation that treats spells as assembly. https://www.goodreads.com/series/43084-wiz https://www.goodreads.com/series/43084-wiz
- _pmf_ 7y agoAphyr and the Redis guy are probably my favorite authors of entertaining, deep technical content (maybe add Raymond Chen).
- luord 7y agoTo say I am confusion would be putting it mildly.
- nathias 7y agoglorious