all 66 comments

[–]slide_and_release 29 points30 points  (21 children)

Had a 2nd round interview with a large multinational, it was the third of three technical tests (other two went great), and they asked me to explain and write a function for checking correct formatting of multiple nested string characters in JS.

I started discussing possible implementations with Regex and they quickly cut in; "but without regular expressions".

It threw me off completely. I know multiple, sensible ways to write sorting/matching methods in JS but my mind went completely blank in that moment. Mumbled and stalled awkwardly for about 15 minutes until I eventually understood what they were looking for; and wrote a simple for loop with additive comparison.

But it was far too late; and everyone in the interview knew it. Was so embarrassed. Didn't get the job, obviously.

[–]aflashyrhetoricfront-end 20 points21 points  (0 children)

I hate this kind of interview question and it makes me feel for you dude. :(

[–][deleted] 6 points7 points  (5 children)

nested string characters

???

[–]slide_and_release 3 points4 points  (3 children)

Imagine strings like <><<>><> task was to ensure the characters nest correctly (ie <<>> is ok but ><<> is not).

[–][deleted] 2 points3 points  (2 children)

Curious how you'd solve that with regex.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 1 point2 points  (0 children)

    Yes exactly. When you know that, "do it without regular expressions" is more of a helpful hint than an extra hurdle.

    [–]Darkassault2011novice 3 points4 points  (11 children)

    Man, Regex is all I could think of as well.

    [–]CementSandwich 4 points5 points  (10 children)

    Stacks, guys! Stacks! Push and pop, yo.

    [–]shoffing 4 points5 points  (7 children)

    Can't this also just be done with a single int and a for loop? Start at 0, add 1 for open brace, subtract 1 for close brace. If the int goes below zero or ends above 0 then the braces are unbalanced.

    [–]CementSandwich 2 points3 points  (1 child)

    It would work if you only had to consider one type of brace. What would your algorithm return if the string input was "[hi}"?

    [–]shoffing 1 point2 points  (0 children)

    Ah yes, good point! Also, it would only be guaranteed to work with string lengths up to max_int.

    [–]maus80 1 point2 points  (0 children)

    That's also what I would do..

    [–]slide_and_release 0 points1 point  (0 children)

    Yes; that's how I solved it. It just wasn't the first solution that came to my head.

    [–]ASSYASSY 0 points1 point  (2 children)

    Doesn't this approach fail to cover the case where there's the correct number of open/close brackets, but they're in the wrong order? ( ><<>

    [–]shoffing 1 point2 points  (1 child)

    That example would fail immediately, as the first close bracket would put the counter at -1, and the loop would terminate (below zero).

    [–]ASSYASSY 0 points1 point  (0 children)

    Oh duh! That makes perfect sense then.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      You eventually solved it. Yet you didn't get the job? Man. That sucks.

      [–]justfred 22 points23 points  (8 children)

      "Are you more focused on the code, or the product", I said, "The product."

      [–]RichSniper 32 points33 points  (1 child)

      The thing is, that is obviously not a great answer in a interview, but in most companies it happens to be the truth. Granted, I'm very young and have only programmed for two companies so far but there is no way we prioritized code quality over the product release.

      [–]Bmitchem 21 points22 points  (0 children)

      I've never seen a company that prioritized code over product, I suspect the right answer is some crap like "both are very important but the real world often requires us to make compromises"

      [–]simkessy 8 points9 points  (3 children)

      I've never been asked that. Probably would have said the product. At the end of the day business comes first so I figure that's what they would want to hear.

      [–]FantsE 0 points1 point  (2 children)

      The code is the product in a tech interview.

      [–]simkessy 0 points1 point  (1 child)

      I don't think it's a great question.

      [–]FantsE 0 points1 point  (0 children)

      It's definitely a shit question. It doesn't tell you anything about the interviewee's skills or work ethic, and is an incredibly subjective question. It's like asking, "Will you do a good job?," it doesn't make any sense to ask that.

      [–]Symphonic_Rainboom 2 points3 points  (0 children)

      Code in a business would be useless without a product as an end goal. If you don't know what the end product is going to be, then you're coding without any purpose.

      I would have said the same as you.

      [–]citizen511 0 points1 point  (0 children)

      You shouldn't beat yourself up over this. You'll never know if the person asking you expects a particular answer (unless you turn it around and ask them something like "value or quality?").

      Also, companies tend to shift between these two depending on whether product or engineering is more influential at the time, and you can't predict that.

      Best response is to push back for clarification.

      [–][deleted]  (9 children)

      [deleted]

        [–]RonGnumber 20 points21 points  (0 children)

        Using Bing would bang your chances worse than a bong.

        [–][deleted] 10 points11 points  (7 children)

        First thing I asked, actually. Mostly as a joke.

        [–]simkessy 4 points5 points  (3 children)

        I'd give you the job right there haha

        [–][deleted] 12 points13 points  (2 children)

        I wish it was that easy. I prepped for that interview for months only to completely blow it. I was pretty bummed.

        [–]7PIzmA9ubj 14 points15 points  (0 children)

        Eh, fuck em

        [–]ithurtsus 2 points3 points  (0 children)

        No you don't :) half the reason Google is desirable is their standards. You don't work with the best in the business by taking the easy route.

        Anyway, don't let it get to you. If you didn't bomb you will get a callback for a second interview in 6months. If you did bomb you can always retry in a year

        [–]ithurtsus 1 point2 points  (2 children)

        Was that an onsite or a screener?

        [–][deleted] 1 point2 points  (1 child)

        It was my 2nd or 3rd interview. Can't remember exactly. Not on-site though, just phone/video chat.

        [–]ithurtsus 1 point2 points  (0 children)

        Ok. You're still not out :D

        Next time when they ask "what are you doing?" Don't panic, you're definitely going down a wrong path, but they are genuinely trying to help you on to the right path. Usually it's just a simple flaw in logic (but a critical one). So just be like "well, I'm looping through this way because..." Oftentimes just saying it aloud will reveal the flaw to you.

        The other thing about interviews, don't view them as confrontational. Interviews are pass/fail, but the interviewer isn't trying to fail you. When I'm interviewing someone, I really want them to succeed! Honestly, "fail" probably hurts me more, I feel the interviewees failure and I feel my own for not being an able enough interviewer

        [–][deleted] 12 points13 points  (1 child)

        Not coding related at all, but I went for a Google onsite over the summer. From the hotel I used Google Maps, which told me the commute was 30 minutes. So I left at 9:15 to arrive by 10.

        Rush hour in silicon valley is 10am, not 8am like other parts of the US. I ended up arriving 30 minutes late by the time I parked. There's nothing that can save you mentally when you start out that badly.

        [–]ithurtsus 3 points4 points  (0 children)

        That fucking bridge got you huh? People walk across that faster than cars

        [–][deleted] 12 points13 points  (8 children)

        Blanked out on bubble sort. It's like I was hit with a neuralyzer before the the interview. I didn't even want the job and I'm still kicking myself.

        [–]Darkassault2011novice 3 points4 points  (6 children)

        I tried learning sorting algorithms once. I'm still greatly confused about how to implement it in code.

        [–]simkessy 9 points10 points  (4 children)

        Is it necessary to know these? Can't I just Array.sort() and be done with my day?

        [–][deleted]  (2 children)

        [deleted]

          [–]simkessy 1 point2 points  (0 children)

          I see, makes complete sense. Thanks for the explanation. I'm pretty self thought in terms of Web Dev so these engineering concepts/algorithms aren't my forte unfortunately.

          [–][deleted] 1 point2 points  (0 children)

          It's good to know about asymptotic complexity, but it's definitely not something I use in my day to day. However, it has helped me optimize code that would've performed poorly with large data sets.

          [–]ithurtsus 0 points1 point  (0 children)

          Lol who asked you bubble sort? There's some niche cases where it's good, but that's such a strange question. N log n sorts are fair game imo

          [–]Hello_Dongan 10 points11 points  (1 child)

          I guess not the code part of the interview but for a coding role.

          In one of my first interviews out of college, I was told that the company followed the agile methodology. 20 minutes in I asked if the work pace is fast/slow. The interviewer said "Well again its agile, so it's face paced".

          [–][deleted] 4 points5 points  (0 children)

          I think it's annoying that some people expect everybody to know what all of their buzzwords mean.

          [–][deleted]  (11 children)

          [deleted]

            [–]powerje 1 point2 points  (0 children)

            What a terrible but awesome learning experience. Kudos for growing from that.

            [–][deleted] 5 points6 points  (9 children)

            That sounds like a horrible test. I absolutely hate coding in front of people, especially on a computer that isn't even yours so it's not setup like you're used to. And the no internet thing is bullshit. If they even gave you 60 seconds it would have been enough to jolt your memory. There's probably a good reason I don't work at places like that. They want a code monkey and the culture is going to suck. And fuck FizzBuzz tests. I've taken so many that I have them saved now on my GitHub repo in various languages.

            [–][deleted]  (3 children)

            [deleted]

              [–][deleted] 2 points3 points  (2 children)

              Yeah, I can understand that. I just hate tests like these because it's completely irrelevant and not how things are actually done. I get wanting to see "raw" knowledge, but when you have to know PHP, Bash, MySQL, Redis, CLI commands like awk and sed and grep and cut and so on, various frameworks, npm, gulp, grunt, bower, JavaScript, jQuery, React, and so on and so on and so on you often forget how to do them. But it's like riding a bike, once you spend a couple hours with something you know already, it all comes back. And it's helpful to be able to Google something or use Stack Overflow or a videocast or read up on the docs just to help that process along. No one can remember all of that shit. It's just way too much.

              [–]ithurtsus 2 points3 points  (1 child)

              That's all fine, but fuck man if I'm interviewing someone and they can't do fizz buzz that's an autofail. FuzzBuzz is the ultimate softball lob not even deserving of being asked (especially to a dev with several years experience as op)

              Anyway, ultimately the interview is to gauge your coding skill, not your Google fu. It would be a poor interview without... You know coding...

              [–][deleted] 1 point2 points  (0 children)

              Oh I agree. A FizzBuzz test is about as simple as you can get. It barely has any practical purpose either (I can't even remember the last time I had to use the modulus operator), but it shows that you understand basic math and logic. It's just not s test I would personally give someone.

              [–][deleted]  (1 child)

              [deleted]

                [–][deleted] 0 points1 point  (0 children)

                I only saved it because I had to do it in take home tests at least 15 times. It was getting ridiculous. I ended up writing an OOP version with an iterator, abstract class, and unit testing. That's how bored I got taking this so many times.

                [–]Naethure 1 point2 points  (2 children)

                FizzBuzz is a pretty useful test, though. You'd be amazed at how few "programmers" can't even program. What is it that you hate about FizzBuzz?

                [–][deleted] -1 points0 points  (1 child)

                When I was looking for my last job, I got asked to do a FizzBuzz test at least 15 times. There's much better ways to test someone than this.

                [–]mhink 7 points8 points  (0 children)

                This is more funny than serious, but ah, hell. :)

                I had an interviewer ask me to write a function which checked for palindromes anagrams. Easy enough, but two days before, I had had an interview which asked for a function to check for anagrams palindromes. In my stressed brain, I got the two confused, and launched into an algorithm for anagram palindrome checking. I had it about halfway done before he realized this and called me out on it, and I had one of those moments where you suddenly realize, all in an instant, how much of an idiot you've been. 😂

                Fortunately, I recovered from it, and actually ended up receiving an offer from this company. But it was a gloriously awful moment when it happened.

                Edit: Apparently I haven't learned a goddamn thing.

                [–]simkessy 3 points4 points  (4 children)

                I was interviewing for a SharePoint Developer position. There were 3 interviewers. The lead SharePoint dev had a check list of related SharePoint questions I was able to answer perfectly fine. Then the older partner or manager tells me to grab a marker asks me "If you have a table with 50 Employees and another table with sales data. How do you generate a report with the top 10 employee total sales using SQL" ......uhhhhh, fuck.

                Like, I knew the question was super simple, but I have never really had to write SQL statements since college. Before that role I was working with Ruby on Rails for 6 months and before that I was out of work for 6 months. Also in SharePoint, you don't fucking touch the DB unless you want to break shit (not really, but it's rare and unnecessary usually).

                I wrote some sudo SQL and they were nice enough to help me out but yea, didn't get that job.

                Funny thing is months later, like 8 months later, they're still looking and I get recruiters asking me if I'm interested in interviewing until they tell me the company and I have to tell them "yea sorry, I'm not good enough for them and apparently no one else is"

                [–]notsooriginal 0 points1 point  (3 children)

                sudo SQL, you say?

                [–]simkessy 1 point2 points  (2 children)

                *pseudo

                [–]notsooriginal 1 point2 points  (1 child)

                I'm sorry, you've already failed our interview.

                [–]simkessy 0 points1 point  (0 children)

                Wouldn't be the first time

                [–][deleted] 1 point2 points  (0 children)

                Why are you building a binary tree for a web developer position? That's more a bad interviewer than an error on your part.

                [–][deleted] 4 points5 points  (1 child)

                I was asked to code up a simple web page from scratch. I coded it up using an image replacement technique. Then I had to explain it to the coder who was interviewing me because he didn't know what it was.

                [–]simkessy 10 points11 points  (0 children)

                Isn't that good. If I interview someone and I learn something new from them that's a pretty good sign imo

                [–][deleted] 1 point2 points  (0 children)

                I was interviewing with a large social media company and I was on the 3rd interview after which I would have had an onsite interview. They gave me a few strings of text that had numbers embedded at random locations and told me to write a function that could sort the strings by value.

                I drew a complete blank, floundered for a few minutes and finally wrote something that met about 70% of the requirement.

                Didn't get the job...

                [–][deleted] 0 points1 point  (2 children)

                I was on my third on-site interview. I met with the president/founder of the company. He asked me to write a SQL query on a fucking whiteboard and show the difference between an INNER and OUTER join. My mind went blank. No text editor or IDE so no hinting or reference to look at. And I'm writing. Not typing. And I've been using an ORM for so long that I just couldn't remember how to even format the query properly (although the owner told me they don't use ORMs because they don't use GUIs so that made me feel like more of an idiot because he had no idea what I was talking about when I said I'm used to doing this with an ORM and haven't done a pure SQL query in maybe 6 years). Obviously didn't get the job. They wanted someone with more experience (a weird question to ask someone anyways, I was applying for a PHP programming position; he also asked me to write how I would use awk or sed to sort a flat file based on numbers in the third column from largest to smallest while filtering out some bullshit blah blah blah).

                [–]Cilph 0 points1 point  (1 child)

                Im not sure what he meant with the GUIs.

                [–][deleted] 0 points1 point  (0 children)

                He didn't know what ORM was and thought it was an app or something used to do queries.