:fa_child: :fa_long_arrow_right: :fa_male: :fa_long_arrow_right: :toilet: I had so much hope for this candidate



  • @RevCurtisP said:

    Is there a way in which I could ask for your help/advice and you would willing to give it?

    Here would be my recommendation:

    1. Start a new thread, don't just cram it in the middle of another thread about something ENTIRELY unrelated
    2. Actually make it clear somehow that what you're looking for is a hypothetical interviewer's reaction to your solution to the coding problem
    3. SOME acknowledgement that you're aware the point of the exercise isn't to solve the coding problem so much as to talk-through your approach to solving such a problem to give the interviewer an idea for how you work

    The real world, like that thing you're in when you're interviewing for a job, it's not a black-and-white world. There's no single "right" answer to the question. I'd hire a guy who showed genuine interest in solving the problem cooperatively, even if it took him a long amount of time. I'd probably refuse to hire a guy who instantly spat out a "correct" answer without bothering to discuss his approach. Because you don't want the latter type on your programming staff.

    When you post a code sample in a thread that isn't about writing code, then ask me what I think of that, well, I'm going to say: I think you're missing the point of the thread. Which is what I did say. I hope that clears up some mysteries for you.


  • Winner of the 2016 Presidential Election

    @RevCurtisP said:

    And this is exactly why I can't work in IT anymore

    Maybe your inability to listen / read is also in your way.

    #I already told you your function fails once a or b are negative. Which is clearly in the specs of "multiply two numbers"
    It's not even "use complex" numbers or anything. Negative numbers are something even a 5th grader would be able to understand.
    And while we are at it, your function delivers results that are as imprecise as mine!
    While I am on that topic:
    #look, I already gave the same answer as you literally 2 posts after the post you replied to
    On the topic of being imprecise: Here is a picture for you (in python because I don't care:)

    Now stop ignoring the elephant in the room and accept that our answer is enough to poke fun at a topic but should never be used in an interview.

    Filed Under: Jeez



  • Unless it's a closed spacelike curve 🚎



  • @Kuro said:

    I already told you your function fails once a or b are negative. Which is clearly in the specs of "multiply two numbers"

    You are correct. I completely missed that post. If I made that mistake here, I would also make it on the job. That's probably why I never earned more than $21/hour as a programmer on my life.



  • It sounds like you should be hiring hipsters.



  • Time is a flat circle.



  • No it isn't, it's an illusion.



  • Lunchtime doubly so.

    Filed under: Somebody had to say it.



  • @blakeyrat said:

    The real world, like that thing you're in when you're interviewing for a job, it's not a black-and-white world. There's no single "right" answer to the question. I'd hire a guy who showed genuine interest in solving the problem cooperatively, even if it took him a long amount of time. I'd probably refuse to hire a guy who instantly spat out a "correct" answer without bothering to discuss his approach. Because you don't want the latter type on your programming staff.

    Is this attitude common? If I was given a simple task, I would assume that the interviewer simply wants to know if I have the skills to solve it quickly and correctly.

    If you want to know what my thought processes are and whether I can work cooperatively, I would expect you to tell me this explicitly. Maybe you do and you didn't mention it or I missed it.

    I'm genuinely trying to get an understanding of the interview process and I figured that a thread about interviews might be a good place to do that.



  • Apropos the title: there isn't a presidential supporter out there in the US right now who isn't saying this very phrase about some asshole who betrayed their trust out on the campaign.

    It doesn't matter which one it was they supported, because they've all done it already. And it's only the end of February.

    But then, there are always those out there unable to realize that the set of politicians capable of reaching national office in an electoral system who aren't psychopaths is an empty one.


  • Winner of the 2016 Presidential Election

    @Kuro said:

    ```c
    return exp( log( abs(x) )+log( abs(y) ) ) * (x<0 ^ y<0)?-1:1;

    
    @Kuro <a href="/t/via-quote/54880/6">said</a>:<blockquote>Yeah, yeah, I wouldn't let me pass with this abomination of a function, either.</blockquote>
    
    No one should.  You failed the criteria trying to handle negative/positive:
    
    @blakeyrat <a href="/t/via-quote/54880/4">said</a>:<blockquote>without using the multiplication operator</blockquote>

  • Winner of the 2016 Presidential Election

    @Dreikin said:

    No one should. You failed the criteria trying to handle negative/positive:

    I feel kinda stupid because it didn't even occur to me until you pointed it out...
    Thats what I get for not wanting to put an if-else around the return...

    Filed Under: Thanks



  • Psst, don't forget the divide operator is still on the table ;)

    Filed under: depending on which version of the question we're going by


  • Winner of the 2016 Presidential Election

    you mean

    template <typename T>
    T multiplyUsingDivision(T x, T y){
    return x / (1.0/y) ;
    }
    

    That one is kinda bland... you can't even show of your knowledge of logarithmic rules....

    Filed Under: I'd still fail myself for this answer :D



  • @Kuro said:

    ```
    template <typename T>
    T multiplyUsingDivision(T x, T y){
    return x / (1.0/y) ;
    }

    
    

    multiplyUsingDivision(1, 0);

    
    Expected result: 0
    Actual result: DivideByZeroException


  • I stopped having hope when...

    pauses

    rereads first post

    Oh, this isn't a political post.

    Carry on.



  • @Captain said:

    Time is a flat circle.

    @Arantor said:

    No it isn't, it's an illusion.

    You people are EDUCATED STUPID.



  • @flabdablet said:

    You people are EDUCATED STUPID.

    Now that reminds me of some of the people that I have interviewed.



  • FINE FUCK YOU l WOULDN"T WORK HERE ANYWAY



  • @blakeyrat said:

    integer, floating point, or both?

    The answer should be hour in integer and minutes in fraction to get the exact value.



  • And the candidate is supposed to do this without any reference(no Googling), right?

    Honestly, I wouldn't have passed it, let alone the TDD approach since I've never had any experience with writing tests.

    I can't say I speak for the entire Korean IT crowd, but your test might have been seen as "too much" here.
    Not that I condone with the above sentiment.



  • Test with TDD approach could be reasonable if that is specified in the job ad. as "required" not "preferred". And even if it's "preferred", they can still include it in the tests, just make sure they won't fail people simply for not able to complete that part, and let candidates to skip it if they confess they don't know about TDD.

    The bottomline is, it's always good to test topics that the position requires and the candidates claimed to know. If they claim to know something and fail related part in test, they deserve to have their credibility lowered.

    And regarding the question itself, when interviewing for programmer/junior programmer position, when given test on area that you know little background, it's almost always welcomed to ask for more detailed instructions. Say when I was responsible for conduction of interview, one of the tasks I use is to perform short division to convert an integer to binary as bytes of "1" and "0". When they ask for more details, I'll give them a short course on short division on paper so they can try to convert what I've written as runnable code.



  • I haven't seen job postings here that required or preferred TDD experience too many times.
    Is it just me or have you seen it a lot here?



  • I've seen quite a few here in Hong Kong, most with big companies or startups.



  • @cheong said:

    Hong Kong

    I don't know where you are from but I was talking about Korea, oh the south one not the north one. lol

    So no, I haven't seen a lot of job posts here in South Korea, stating that they require or prefer TDD experience.



  • IMO, it's more common with team leads who have studied in U.S. and come back after worked a while there.

    I remembered that around 2010, there were people who were obsessed by the fact that you've automatically gain 100% test coverage with TDD approach without the need to hire "whitebox QA". That made it a quite popular decision when starting new projects around that time.



  • Go to hell, I don't want to borrow your damn screwdriver anyway!



  • Silly. Even with TDD, having additional checks is still valuable, and in any case unit testing is only one aspect of software testing. What is going to happen at integration? Let me guess: they just wing it.

    OTOH, TDD would be a big improvement on the QA (or lack thereof) I've seen most companies do. It's a nice idea but one that too easily gets sidelined when it gets in the way, like most 'agile' practices. The fact that the specific practice is less important than the discipline of having such practices, in order to avoid constant firefighting later on, is lost on most people (including myself, all too often, I'll admit).

    OTOH, a one-size-fits-all approach never fits anyone well, so what's really needed is a way to figure out at the start of any new project which methods are most appropriate to that particular project. The best paradigm, methodology, review, etc. won't be the same for all projects, but most firms (if they have any process to speak of in the first place) just try to shoehorn the job into their favored approach (or the fad of the week, if they don't have a pre-set opinion) without regard for applicability. OK, so a sort of Catastrophe of Infinite Regress is possible if you keep evaluating your evaluations, but still, some sort of evaluation should be considered, mmmkay?


  • 🚽 Regular

    @Ascendant said:

    And the candidate is supposed to do this without any reference(no Googling), right?

    Googling for language reference was fine. However, if he googled for "code to find angle between hour and minute hand of clock" or something similar, we would have stopped him right there.

    @Ascendant said:

    Honestly, I wouldn't have passed it, let alone the TDD approach since I've never had any experience with writing tests.

    The guy did that voluntarily. We didn't ask for it in our question, although he did know from our job posting that we preferred people who at least had knowledge of unit testing, even if it wasn't purely TDD.

    @Ascendant said:

    I can't say I speak for the entire Korean IT crowd, but your test might have been seen as "too much" here.Not that I condone with the above sentiment.

    Even for a senior position? I mean, I could understand it being a little intimidating for entry level (even though I firmly believe any decent CS college grad should still at least provide a working function, even if it's not as elegant as a senior would write it), but we were looking for someone who showed some skill beyond fizz buzz and Fibonacci. And it's not rocket science. If you know now many degrees each hour is (360/12) and how many degrees each minute is (360/60) you've already taken a pretty solid first step in solving the problem.


  • ♿ (Parody)

    @blakeyrat said:

    Start a new thread, don't just cram it in the middle of another thread about something ENTIRELY unrelated

    TDEMSYR

    @blakeyrat said:

    Actually make it clear somehow that what you're looking for is a hypothetical interviewer's reaction to your solution to the coding problem

    I can't imagine what else it would have been.

    @RevCurtisP said:

    I guess this is a an example of my inability to communicate clearly.

    Only in that you engaged @Blakeyrat.



  • The bosses think: I can advertise my software package "with 100% test coverage" without having to pour addition money with TDD, that's good.

    Btw, just like what you said, have some test is better than no test at all.



  • @The_Quiet_One said:

    Even for a senior position? I mean, I could understand it being a little intimidating for entry level (even though I firmly believe any decent CS college grad should still at least provide a working function, even if it's not as elegant as a senior would write it),

    Is the clock problem not, in fact, reasonably trivial, or am I just some sort of super genius?



  • It is just that we have too many nincompoop around in the industry.


  • 🚽 Regular

    @RevCurtisP said:

    Is the clock problem not, in fact, reasonably trivial, or am I just some sort of super genius?

    As much of a super genius as those who can solve those 1 - 3 * 8 + 2 math problems. Yet, even the folks with the most seasoned resumes seem to struggle with it more often than not.



  • @The_Quiet_One said:

    As much of a super genius as those who can solve those 1 - 3 * 8 + 2 math problems. Yet, even the folks with the most seasoned resumes seem to struggle with it more often than not.

    You would think that before the Internet and StackOverview, it would have been harder to get away with this, but even then I saw bbarely functional programmers somehow hang on to their jobs for years.



  • @RevCurtisP said:

    Is the clock problem not, in fact, reasonably trivial, or am I just some sort of super genius?

    It would not be trivial for me. It's been over 10 years since I've sat in a Math course, and maybe 20 since I've had to work geometry. The majority of math I work with now is off-by-one, logarithms, base conversion, Boolean algebra, and basic algebra. I had to think about it for 10 minutes, so I don't consider that "trivial," simply because I don't use that knowledge anymore.

    The only hard part of the exercise is recognizing that the angle of the minute hand is the minutes * 6, and the angle of the hour hand is hour * 30 + minutes / 2.



  • @BaconBits said:

    The only hard part of the exercise is recognizing that the angle of the minute hand is the minutes * 6, and the angle of the hour hand is hour * 30 + minutes / 2.

    Well, yeah, but actually getting them isn't that hard. The minute hand goes around (360 degrees) once an hour, or 60 minutes, so you could say minutes / 60 * 360; same basic approach for the hours, (hours + minutes / 60) / 12 * 360. Simplifying those to minutes * 6 and hours * 30 + minutes / 2 is just plain algebra.



  • I didn't do any calculations at all. I just thought about it.

    Here's what I did with my 10 or 15 minutes.

    First, I wasted a bunch of time thinking about sine and cosine because I went off on thinking the clock face is a lot like a unit circle, and it seemed really irritating that you'd have to convert back and forth between 60 minutes and radians, and the unit circle is out of phase with the clock face. I had a lot of calculus and trig in high school and early college, so I guess I tend to start with that. Like I said, it's been a long time since I've had to think about this.

    My thought process was then:

    Wait a minute. The ancients picked 360 degrees for a circle for a reason. It divides by just about everything, including 12 and 60. That's too elegant not to abuse because it's going to be integer math. The requirements didn't ask for specific units. Start with minutes. Basically, I have to map 360 degrees to 60 minutes. That's pretty easy since 6 * 60 is 360. If I just use 12 noon as the 0 point, that makes it just minutes * 6 and it just works. If I know the angle relative to a fixed point of reference, the angle to each other should be easy enough to determine from that.

    So, how about hours. Well, there's 3 hours between 12 noon and 3, and that's 90 degrees. So that's 30 degrees an hour. However, the hour hand also moves according to the minutes. Hm, but it's just proportional to the minutes, so it's essentially got to move 30 degrees over 60 minutes. So 1 degree every 2 minutes. So it's hours * 30 + minutes / 2.

    So, the absolute value of the difference of those two values is the angle we're looking for.

    Hm,,, this is going to have really high angles if the function is passed 24 hour time. Well, it's still correct, it's just doing complete circles. Actually, if you use 12 hour time, it's also going to be weird for the first hour of the day after midnight, too. The angle is still correct, even if it's greater than 360 degrees. It's not a a "normalized" angle... although 390 degrees or whatever is a valid angle even if it's weird, but even then it's still right. Well, you'd just have to take the modulus of the angle by 360. And I guess if you wanted the smallest angle you'd just check to see if it's greater than 180, and if so, subtract it from 360.

    Wait, whatever, none of that matters because none of it is in the requirements. Absolute value of the difference of 6 * minutes and hours * 30 + minutes / 2 answers the question without adding anything fiddley. This meets spec, so it's the important part of the challenge.



  • The minimal unit test would be OK to start with, as long as the candidate made it clear that it was only a placeholder or sketch of what he would actually use. It doesn't sound like this was the case. As for the methods themselves, this is my own solution, not great (the whole thing of using an scaling offset might be problematic with some types of angular units, for example) but it should at least work for the demonstration:

    public class Clock
    {
        public double getAngularDifferenceDegrees(int hour, int minute)
        {
            return getAngularDifference(hour, minute, 360.0);
        }
        public double getAngularDifferenceRadians(int hour, int minute)
        {
            return getAngularDifference(hour, minute, 2 * Math.PI);
        }
        private getAngularDifference(int hour, int minute, double scale)
        // returns the absolute angle between the hour hand and minute hand of
        // standard analog clock by a given scaling factor
        {
            // just to be as specific as possible, let's explicitly get the
            // unit angles for the hour and minute hands
            double unitAngularHour = 12 / scale;
            double unitAngularMinute = 60 / scale;
            // and now, with equal pedantry, we get the angles of the hour
            // minute hands offset from the 0 (or 12) mark
            double thetaHour = hour * unitAngularHour;
            double thetaMinute = minute * unitAngularMinute;
            // find the larger and smaller of the two angles
            double greater = Math.Max(thetaHour, thetaMinute);
            double lesser = Math.Min(thetaHour, thetaMinute);
            // return the difference
            return greater - lesser;
        }
    }
    

    Was that so hard?

    Filed Under: Complaints about bugs arriving in 3, 2, 1...



  • It's just funny how it's absolutely impossible to have some discussions with developers. For example, you can't talk about how to judge interview candidates because the instant someone posts a sample interview problem, the thread turns into "let's solve this sample interview problem in as many ways and languages as possible and completely ignore whatever previous discussion existed".

    Maybe this is why the IT interview process is still so broken after all these years.

    It's kind of like Blakeyrat's First Law but for interview questions.



  • OK, you have a point, there. Guilty as charged. Must be the 'I can always find a solution to any problem and have to prove it whenever I can' attitude most programmers have.

    It's especially absurd because we aren't doing it while under the spotlight of the interview, so our answers aren't really comparable to what the candidate would come up with on the spur of the moment.

    Yeah, this isn't productive. Mea culpa.



  • Sorry it wasn't a response specifically to you, I should have hit the other Reply button. By the time you posted that, it'd already been done by a half-dozen others.



  • @BaconBits said:

    had to think about it for 10 minutes, so I don't consider that "trivial," simply because I don't use that knowledge anymore.

    I would consider any solution that can be written in under an hour to be trivial. Outside of any specialized knowledge, of course, but the number of degrees in a circle should be common knowledge.


  • 🚽 Regular

    @RevCurtisP said:

    but the number of degrees in a circle should be common knowledge.

    Sadly, seeing how many people I've encountered who say "he/she took a 360 turn" to indicate they metaphorically turned around and walked away from a situation, this isn't necessarily the case.



  • @The_Quiet_One said:

    Sadly, seeing how many people I've encountered who say "he/she took a 360 turn" to indicate they metaphorically turned around and walked away from a situation, this isn't necessarily the case.

    I would hope that the union of those persons and professional programmers would yield a small result set. Not expect, mind you, just hope.


  • sekret PM club

    @The_Quiet_One said:

    Sadly, seeing how many people I've encountered who say "he/she took a 360 turn" to indicate they metaphorically turned around and walked away from a situation, this isn't necessarily the case.

    http://i3.kym-cdn.com/photos/images/original/000/207/285/1322254155940.gif



  • Step 1: person stands up
    Step 2: person turns around
    Step 3: person realizes the exit is on the other side of the meeting table
    Step 4: person continues turning around until they have completed a full revolution
    Step 5: person jumps over table
    Step 6: person leaves room through giant wall hole next to door



  • @ScholRLEA said:

    Complaints about bugs arriving in 3, 2, 1...

    double unitAngularHour = 12 / scale; double thetaHour = hour * unitAngularHour;

    Instant bug detection via units analysis. If 12 is in hours per revolution and scale is in degrees per revolution (as it appears to be given the numbers passed in) then unitAngularHour is in units of hours per degree. You then multiply that by a number of hours, which yields a result in hours squared per degree, which is wrong.

    When writing this kind of thing I like to build the unit names into the variable names, making it easy to check that the calculations make sense. So instead of unitAngularHour I'd have used anglePerHour which would have made it instantly apparent that the associated calculation should have been scale / 12 rather than 12 / scale.

    The logic around greater and lesser is dubious as well; it's just a circuitous way to calculate Math.Abs(thetaHour - thetaMinute). This doesn't calculate the angle between the hands; it just makes the reported angle positive, meaning that it will be relative to whichever hand is further around the clockface. For example, at 11:00 it would return 330° rather than the 30° you presumably intended it to.

    Edit: also, at 12:00 this logic would yield an angle of 360°.

    There is no such thing as trivial time-related code. If it has anything to do with time, it needs to be carefully thought through and thoroughly scrutinized for edge cases.

    This last point is something I would expect any competent developer to raise, if presented with an even vaguely time-related problem in an interview.



  • @ben_lubar said:

    Step 1: person stands up
    Step 2: person turns around
    Step 3: person realizes the exit is on the other side of the meeting table
    Step 4: person continues turning around until they have completed a full revolution
    Step 5: person jumps over table
    Step 6: person leaves room through giant wall hole next to door

    Not too dissimilar from the candidates approach I the original post, bringing this thread full circle.



  • @flabdablet said:

    There is no such thing as trivial time-related code.

    This particular problem is only tangentially time related, in that the hands of an analog clock are a ubiquitous example of an angular system.

    For an actual time and/or date problem, I would hope the candidate would ask what language and/or library functions are available. IMO, using existing standardized cider rather than rolling your own, is a clear delineation between a novice and seasoned coffee.


Log in to reply