Hacker News new | past | comments | ask | show | jobs | submit | more mmorett's comments login

Yet another thread full of HNers sitting back and contemplating various ways to take other people's money like a Soviet central planning committee. Can you fuckers stop worrying about how much money someone else makes or whether they got it thru inheritance. It's not your money. It's none of your business.


Who gives a shit where they "want" to live. I'd like to live on the upper east side in Manhattan. Time for them to move to a place they can afford and stop the whining. I hear Detroit has a lot of cheap housing.


Ironically, this is the true anarcho-capitalist approach to the problem. Part of Anarchy is that when the prices go up and you can't afford the area you're living in... you should move out to a place you can afford.

It is strange to see Anarchists as the ones who are most rebellious against gentrification.


Different anarchism branches disagree very strongly on some issues. That's not surprising at all.

However, the housing market in SanFran is anything but free.


Because it's free. Or they learned it over the years (and began with it, because it's free). IntelliJ is only $199, yet "professional" developers insist on using Eclipse. Like, $199 is too much to spend on your craft.

Screw FizzBuzz...the first question on an interview should be: Do you use Eclipse? That speaks volumes, far more than a silly set of "if" statements and making use of the modulus operator.


>I don't see how anyone with practical experience developing commercial software could write something like this.

Exactly. Using IntelliJ "holds me back", but if I bust out vim, somehow my code will miraculously get better. Sigh.

What I type, or not type, holds me back. Not the editor. That's just a means to an end.


I normally just lurk, but I signed in just to upvote him. Still laughing...


I'm torn on this. I get what quanticle is saying, that Big-O is very important. I've developed an appreciation for it even if I didn't take CS in college (I took the redheaded bastard stepchild major of CIS).

quanticle is suggesting there is a purposeful, formal means of discussing and identifying performance, irrespective of how it's measured/profiled or addressed.

Here's the rub: why don't job openings eliminate the other requirements and just put Big-O (and a language) as the two must have items on the list. Keep it short. Eliminate the History majors, the non-college types and the CIS (almost but not good enough) types.

That, more than any FizzBuzz, should weed out the chaff instantly. If it's that important to that specific job, then just say so explicitly. Help folks self-filter themselves out.

Let's just hope getting in the door with that Big-O knowledge isn't wasted on run of the mill CRUD apps.


"In my experience, when we are programming on the job, we're given the problem and we have time to think about it. We have time to research possible solutions, we have time to try stuff out that we know will most likely fail, and we can wait until we have something decent before we show it to our colleagues"

^This * 2

:-)

That's exactly how it played out on this thread in real life. Let me explain.

philwelch mentioned something about using anagrams as simple example to test for coding knowledge. My first attempt was a solution to palindromes. (Seriously...I totally botched the interpretation of the problem).

Elsewhere in the thread, typicalrunt sketches out some Ruby to show the answer but the crucial piece was him mentioning "sort(word1) == sort(word2)". I didn't know that. Language aside, I get it now, but I didn't then. If you don't know that, all the knowledge of language syntax in the world won't help.

So, just sort two strings. Cool. Except, I had never sorted a single string. It just never came up in day to day work. A quick peek over on StackOverflow yielded two bits of information I needed (I'm doing this in Java).

1. Convert the string to a charArray (something else I never used).

2. Sort the charArray using Arrays.sort()

With those pieces in place, the solution became evident.

But....I'm doing this at home with the TV on, relaxing, with nothing on the line, no one looking at me, the ability to research things, and generally no pressure at all. I was just curious on how to get the answer.

Change that to a job on the line, typicalrunt's advice/pseudocode not available and folks staring at you, and it's not going to end up the same way. I drew a blank at home. I'd definitely draw a blank in an interview.

Elasped time to solution (actual coding): < 1 minute.

With solution in hand, am I now somehow "better" as a developer? I think not. I did what I would do on the job: research when needed and apply it to the problem at hand. I could be faulted for not ever having used toCharArray(). Fair enough. But in the grand scheme of things, did it matter? Heck, there's plenty of pieces of the Java language I don't use daily or not at all.

Anyways, I just wanted to share how this played out.


HN seems to lack reply links in some messages so I need to answer you here.

"If you can't check an anagram given the definition of an anagram and the programming language of your choice, what problems can you solve? It's not a hard question and if you can't come up with a correct solution at all, I dare say you lack the ability to program."

Here's your anagrams checker tough guy:

  static boolean anagram(String word1, String word2) {
    char[] chars1 = word1.toCharArray();
    char[] chars2 = word2.toCharArray();
    Arrays.sort(chars1);
    Arrays.sort(chars2);
    return Arrays.equals(chars1, chars2);
  }
I was speaking in the abstract, but you made it personal.

Would you like me to build a search engine next?


Okay, now make it faster.

I'm not trying to be obnoxious, but your answer is not optimal. Which is not a big deal, and it would give us a chance to talk about ways of optimizing code. Sooner or later we'd figure out if you knew what a hash table is and how to use it (no real points off if you never really got, under the pressure of an interview, the hash table solution to this problem), how you would go about profiling code, how you might solve this if they weren't strings but social security numbers, and so on. It's a launching off point to more interesting discussions. At least that's how I'd use it in an interview. Before long we'd be talking about a, I dunno, search engine or something.


Lol!! You're killing me. I need to work tomorrow and you're gonna have me up all night thinking how to optimize this thing. It's only 5 lines of code.

Hashtable, huh? I don't like them because they're synchronized, but let's use a HashMap instead. Regardless, I'm stumped.

Let me think out loud. You'd probably want me to stick two entries in there with the words being the values. I suspect the keys are irrelevant. But I need the values themselves sorted prior to being placed in the map. Lets assume I stick the char arrays in the map. I still can't see how the map helps. Unless, I abandon the HashMap and go with a TreeMap instead. That negates the need to explicitly sort and maybe that's the time savings, but....

My head hurts. :-)

I don't know. I'd have to code this out and experiment a bit. But I like the push. You're forcing me to dig deeper.

PS. I can't build a search engine.

EDIT: A quick search of the net yields at least one answer (don't know if this works):

"We can solve this problem in O(n) time by using hashtable. That is, create a hashtable which record the times that the characters a-Z appear in S1 and create another hashtable for S2. If the two hashtables have the same content, then the strings are identical. This solution requires O(n) time to create two hashtables and compare them, and O(52) = O(1) space to store the hashtable."

I'm so disgusted. I was way off. Not even close. I wasn't even thinking in this direction. Does anyone have the number to that truck driving school?


I'm pretty sure the sort solution would be an order of magnitude faster on any reasonably sized string. Big O's are Big O's : they are irrelevant when n is small, and for anagrams we're talking something like n < 45.


Reply links take longer to generate on HN as comment threads get deeper in order to deter people from losing their temper and flaming each other. In your case I would say that didn't quite work. My comment was not meant personally but as a general statement. If you had kept your composure and waited for the reply link to show up instead of flying off the handle about it and replying to an unrelated comment, perhaps we would be having a more productive conversation right now.


Then please accept my apologies. I enjoyed the anagram thing as it forced me into looking into it.


Since a reply link isn't available for spacemanaki's comment, I'll stick it here:

"The purpose of a question like this, and of the classic FizzBuzz question, is to be a lightweight test of whether a candidate can actually write code or not. That's all. It provides a negative signal if they fall completely to get anywhere close, and nothing more."

I disagree. Vehemently. Provide me an email address and I'll mail you tons of code I've written. You cannot, cannot conclude with any accuracy that the inability to code up a method/function to check an anagram means that the person cannot write code. What you can conclude is that they cannot write up a method/function to check an anagram.

You're making an assumption. If a = b and b = c, then a = c. That works in math class but not here. The test is not one of syntax or knowledge of the language but of knowledge of a specific problem. Some here have used the word "trick". I don't even need to go there. Once you have the answer to this anagram exercise, you can back into why it's a good question, what it supposedly shows, etc. At that point you're justifying the question and defending it.

But you missed the entire point of the exercise: you're supposedly screening candidates for knowledge of a language and how they might have used it in their past experience, but letting it all come down to whether they solve your specific problem on the spot with all of Pamela's concerns about stress, etc.

It's easier to ask about an anagram than to ask about a candidate's past and what they did on their projects. If not an anagram, there are others. There will always be "solve this now" rather than "tell me about..." That's just the game.


> You cannot, cannot conclude with any accuracy that the inability to code up a method/function to check an anagram means that the person cannot write code. What you can conclude is that they cannot write up a method/function to check an anagram.

If you can't check an anagram given the definition of an anagram and the programming language of your choice, what problems can you solve? It's not a hard question and if you can't come up with a correct solution at all, I dare say you lack the ability to program.


So, I understand and am incredibly sympathetic to the stress problem some folks have. I also occasionally freeze up when put on the spot, though I fortunately tend to recover after a minute or so of verbal stumbling.

That said, hiring quality engineers is HARD, and often ends up coming down to a numbers game. If I've got 100 applicants to go through and know (from past experience) that over 80% of them couldn't code their way out of a wet paper bag, then I need short, deterministic interview techniques that will identify those candidates who are actually worth my time. Thus: fizzbuzz. I've met lots of folks who talk a great game, have all kinds of experience listed on their resume, and yet somehow can't write up a linked list or fizzbuzz solution in any language.

So, I accept that there will be some false negatives in order to more quickly narrow the focus down to those few rare folks that can actually code. It sucks: it isn't entirely fair to folks who struggle with stress/nerves, but I need a 5-15 minute litmus test that can be done remotely and I haven't found anything else more effective.

Short of wasting everyone's time with take-home projects (which I often employ in later stages of the interview process), what other options are out there?


That's the $64,000 question. If I knew the answer, that would be my startup. It's a tough problem. It almost makes one beg for some sort of one-off certification (bar exam?) so we can put that to rest for ever after. I'll go out on a limb and say that most lawyers, especially the senior ones, probably couldn't pass the bar exam again. Developers have a mini bar exam every time they interview (hence the studying).

That said, there's one thing you wrote I took interest in: "I've met lots of folks who talk a great game, have all kinds of experience listed on their resume, and yet somehow can't write up a linked list..."

Umm...that would be me. I've never written a linked list. Guilty as charged. Java has a LinkedList class and I've never bothered to look at the implementation nor have I ever been curious enough to (re)write one from scratch.

I wish you would have said "...and yet somehow don't know when to use a linked list." That moves it from an academic exercise mostly applicable to CS students who might have written one 6 months ago, to a meaningful real world scenario and more than legitimate. Choosing the appropriate data structure, knowing when and why, is both realistic and important. I don't know how a candidate can bullshit their way thru a discussion of data structures where they can articulate, accurately, which one to use, when, and why.


> I've never written a linked list. Guilty as charged. Java has a LinkedList class and I've never bothered to look at the implementation nor have I ever been curious enough to (re)write one from scratch.

Good! You're right: the JDK's implementation is perfectly acceptable, and you'd be crazy to write your own. I certainly haven't, either.

But if you have any CS education, I'll bet you know what a linked list is at a high level. And I can probably verbally walk you through turning that into a "spec" that's good enough for a basic whiteboard implementation of one that supports a couple of basic operations. It's (hopefully) just another fizzbuzz: a simple problem to demonstrate that you can code something/anything. The overwhelming majority of applicants can't.


I'll ask you a slightly different question then: when is it appropriate to use a linked list? In which of those cases might it still be inappropriate and why?

These things can be memorized of course but I find that if one has a reasonable understanding of the underlying machine and knows how to implement a range of data structures and algorithms the answer to these questions (for most of the less specialized data structures) becomes quite straightforward. Whether that is relevant very much depends on the job being interviewed for however.


Salient points all, I wish I could have stated my views as eloquently.


I happened to have a conversation with someone about this recently.

Software developer: the career where you study to get the job, toss much of that away when you actually do the job, then study for the interview for the next job, where you toss much of that away when you actually do the job...

It's a rhetorical question, but I can't understand studying for a job. You either do it on the job or you don't. Studying, however, puts a ton of stuff in short term memory where it gives the appearance of brilliance.


See that's where I want to dig deeper with those that really believe in this style of interviewing. Clearly it must have some value other than the weed-out factor.

Are there engineers who actually keep the algorithms/data structure stuff in their head and find small ways to apply it while they work on a standard web or mobile app? That's the only way I could see the knowledge having any value, but I've never worked this way nor have I observed anyone who works this way.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: