Interviewing applicant

>interviewing applicant
>ask her to sum all prime numbers under 2 million
>she can't do it
>think "ok, maybe she's just having a bad day"
>ask her to do a bubble sort
>she asks what one is
>realize she's not going to get hired but explain to her what it is because surely he can do that
>she has no idea what to do and fails it
There is a reason why you don't see many women working for tech companies

>not just asking her to do fizzbuzz
You're a bigoted piece of shit. Congratulations.

so, how do you sum all prime numbers under 2 million?

first you aquire them
then you add them up

Implement a prime number sieve and keep a rolling sum.

If number

OP would you have cared if she brute forced the solution the your prime numbers question?

import the library that holds the sieve of erastothenes and then sum it up

>interviews are a fucking joke

Didn't someone make a thread about this like yesterday with the exact same questions?
Is this some kind of meta Sup Forums meme?

WRONG

You sum and then acquire

>>ask her to sum all prime numbers under 2 million

In what world is this a useful skill?
In what way would you not be better served by running someone elses script?

The problem is so trivial that it could be implemented without libraries faster than one could google a library, look up the documentation, and then hack up a solution.

>array
Why not just add them to a running total instead of doubling your resource usage like that.

it's called gatekeeping, user

everyone had to learn this pointless thing in school, and it's actually quite simple, once you learn how to do it. it's not actually useful though

however: once you get hired, you can ask everyone on the spot if they know how to do this thing while they're stressing out about their big job interview.

the end result is that you get to filter out everyone who's not just like you. it never actually results in better software

The purpose of problems like this is not to test your ability to do practical work, but your ability to solve new and unexpected problems. If you can't solve something as simple as summing all of the primes up to 2 million, it suggests that you are only good at googling problems and using other people's code. The second something new is needed, you're dead weight.

>new and unexpected problems

haha, no. they're the same problems over and over again, people who are self-taught just don't get years of repeated exposure to them

>he seriously thinks this

Are you fucking retarded? Have you ever been to an interview before?

The interviewer doesn't want to know how to do it, the interviewer wants to know if you can think logically, plan out a basic approach to solving a problem and clearly explain your thought process. Asking a trivial question like the fizzbuzz problem give you an opportunity to show these qualities or lack of, it has nothing to do with how useful or applicable the solution is.

In what world did you think an interviewer wasn't looking for that?

Its dumb because there is no REASON to do it. Its like asking somebody to sit still and count to a million.

It's a way to filter people out. If you've got two equally good candidates on paper and one of them knows what to do and the other one doesn't of course you're going to hire the competent one. Replace this test with fizzbuzz or any other number of tasks the logic behind doing it is still the same.

>"I think this test is dumb and I refuse to do it"
This is why you're unemployed.

A real test is asking somebody how to design a GUI component or design a website. This shit is just pointless, nobody works with pure numbers like a turbo autist.

whats more useful, knowing that an array terminates at zero or the how to use a graphics API to design a formsheet?

...

But thats what I'm saying, you are filtering people based on an abstraction that will never occur in the workplace.

You are basically saying, "I had to sit through calc so you do too"

fuck you. do you know what a prime number is? do you know how to sum two numbers in a programming language? do you know what a basic loop is?
then you should know how to sum all prime numbers under 2,000,000. If you can't do that, then get the fuck out I don't want you at my company.
also, bitch should have been like "what is bubble sort?" and then the interviewer would surely explain what it is, and any programmer that passed CS1 should then know how to implement it, or at least scribble some psuedocode. none of these interviewers seriously expect you to have the algorithm memorized down to the semicolon.

The problem is not hard, but its intimidating. You should ask them to do something that you might see somebody do in the real world.

When are you ever going to be working with raw code without a reference?

I mean ffs, I'm useless without my reference database, my handbooks, manuals and all that other shit coders use to build algorithms.

>sum all prime numbers under 2 million
>calculus
fucking lol. user, this is middle school math. it requires week one knowledge of programming basics and middle school math skills.

just search the solution

>This shit is just pointless, nobody works with pure numbers like a turbo autist.
Honestly, as long as you know what a prime number is, there are a number of trivial solutions to the problem. You don't even need to use a sieve (although it is the most efficient manner in terms of time). Every programmer should know how to check if a number is divisible by another number (x divides y if x mod y is 0), and every programmer should know how to iterate.

>whats more useful, knowing that an array terminates at zero or the how to use a graphics API to design a formsheet?
You can learn the graphics API in a day or two. If you're using a language with null-terminated strings, such as C, and you aren't aware of this fact, you are going to introduce security vulnerabilities.

Only if you've been taught and instructed how to do it.

Which if your self taught is unlikely.

You have to check if a number is divisible by 1, itself, and every other prime number. Thats not an easy thing to wrap your head around without an example or demonstration.

Your basically asking them to repeat a specific example from what they learned in class in their first couple years of programming. Who the hell is going to remember that?

How would you feel if I asked you to solve a quadratic equation, no google? Its not hard, but its tedious, time consuming, esoteric, and there is absolutely no reason to memorize it unless you work with it everyday.

I don't think you really know shit about programming front end software.

no. an example of an intimidating problem would be something like: use dynamic programming to find the longest square sub-matrix of 1s present in a given binary matrix

sum of prime numbers under 2 million? I fucking dream of an interview that easy.

but how the hell are you supposed to iterate every prime number that follows the first without storing it in an array or something?

Checking if a number is divisible by 1 or itself is easy.

>it never actually results in better software

First guy comes in, I give him the fizzbuzz problem, he is stuttering something about the problem being trivial and pointless, then grabs the whiteboard marker and scribbles incomprehensible arabic shit, I can't read it and he can't explain anything about it clearly, I ask him to step me through what his code does and he starts in the middle of the process, something about checking i for 15 instead of 3 and 5, that's correct and well done but that's all he said about it.

thank him and tell him we'll call

>vs

Second guy comes in, give him the fizzbuzz problem, he walks me through his approach, very clearly, explains a few ways to do it and picks one with multiple reasons as to why, grabs the whiteboard marker and writes comprehensible code, explains what each line does and explains to me the pros and cons of his approach then finishes with telling me the solution is in o(n).

Ask him if he can start Monday.

Do you see how asking trivial brainteasers isn't about the actual end product? even if the first guy had a better solution he would ultimately be a detriment to the team because communication is more important.

>use dynamic programming to find the longest square sub-matrix of 1s present in a given binary matrix

how bout I ask you a follow up question.

WHY?!

Because the fundamental theorem of arithmetic guarantees that a number has a unique prime factorization, so rather than naively checking all possible factors, you can just check possible prime factors.

Or, you could just use a sieve.

Because your not a sphinx!
You need warm bodies behind the machine, whether you admit it or not.

Design a PRACTICAL problem that deals with something in the real world.

recursion dummy

Why in the hell do you want me to solve a problem that has been done a million times before?

All you are going to get is copycats who copied the answer off somebody who already solved the problem and prepped for the exam.

Yet when I ask to do the same thing in the office on my laptop instead of painfully trying to demonstrate it on a whiteboard like I was a fucking theoretical physicist, you say I'm not allowed.

its to prove you have social skills, which you obviously lack

So what, you're testing them to see how well they bullshit?

I have yet to hear a reason as to why they can't make up a story for fizzbuzz, if you need a narrative so bad I'm just going to hire the guy who doesn't.

asking someone to print 1..100 with some checks in between shouldn't be this big of an issue.

You're asking me to construct a problem that deals with real world problems. What does that give me that FizzBuzz doesn't?

I'm looking for how clearly someone can explain a solution, why does the context of the problem matter?

How well you can work as a team, how well you can explain a solution to a team...

basically this

...

haha just solved that a few hours ago
fucking dp and stack shit what the fuck is that
literally took a week for me to think of the solution

give them the bs scramble word problem, that's still throwing me for a loop

Sometimes, just sometimes, a company will need a person to develop algorithms for data analysis in feedback loops. Doing GUIs and web development isn't going to cut it, and fizzbuzz questions won't test you in the right areas.
Welcome to working social norms in the western land.

>You're asking me to construct a problem that deals with real world problems. What does that give me that FizzBuzz doesn't?

An actual gauge of their skills and talents outside of the classroom? The ability to do something other than repeat verbatim what they have heard through word of mouth through other people who have gone through the same interview?

A chance to show them what they DO know instead of what they don't?

Do really need how to do this for HTML scripting? Does you're JS script have to be able to calculate pie to the last digit?

Its the same thing as hiring people on their basis to memorize Monty Python quotes!

haha oh sorry you specified it was square
recursion is m[i][j]

Well if you're hiring them on the basis of their ability to write analytical algorithms using database queries, why are you even considering somebody who specializes in web development?

No, this is why tech companies are filled with sexist asshats clinging to the "big boys club" mentality.

>recursion is m[i][j]

>Do really need how to do this for HTML scripting?

>Do really need how to do this

>Does you're JS script

>Does you're Java Script script

>you're

>Java Script script


remember to poo in the loo

Imagine it were a new problem with no solution that is unique to the company. Imagine the libraries available are of poor quality, buggy, non-existent, or solve a problem that is similar to what you are doing, but doesn't quite hit what you need. YOUR JOB is to come up with unique solutions. You are not a carpenter, you are an engineer. Does a bridge maker copy the same suspension bridge across every river, every time, or are there environmental factors to take into consideration in how he tweaks his solution to the problem?

The time-inefficient (but space-efficient) solution is to use two loops and a counter. Outer loop goes from 2 to 2 million (since 0 and 1 are both not prime by definition), inner loop goes from 2 to the square root of the value of the inner loop. If you aren't aware that you only need to go up to the square root, you could just loop up to the value of the inner loop, but that would make the program take longer. You check if the value of the inner loop is divisible by each of the values of the outer loop. It's not the best solution to the problem, but it's a solution to the problem, and what might be expected from someone who knows what a prime number is, but not what a sieve is. If you know what a prime number is and how to test for divisibility, but can't at least come up with this solution, then it shows you don't understand iteration, and need to go back to university.

A person who can't do FizzBuzz is incapable of doing basic iteration and conditionals. That's all you need. You don't even need to know how to test divisibility; I've solved it without the modulus operator, trivially. Since practical tests are more time consuming, it is helpful to filter out all of the idiots who can't even do FizzBuzz.

>An actual gauge of their skills and talents outside of the classroom?

we get that from their portfolio, I want to know how well they can communicate a solution to me on the fly.

>A chance to show them what they DO know instead of what they don't?

we get that from their portfolio and from the question "what's the most unique coding problem you've ever solved and how did you go about solving it?", I want to know how well they can communicate a solution to me on the fly.


>Do really need how to do this for HTML scripting?

I need to know how well they can communicate their reasoning for why they laid out the code the way they did, yes.

>Its the same thing as hiring people on their basis to memorize Monty Python quotes!

Are you seriously this stupid?

You can't always use acronyms as shorthand when talking to laymen. People still call them SSD "drives", not SSD's

>her

>Only if you've been taught and instructed how to do it.
I would kinda hope that people going for a tech job would have qualifications (eg. have been taught and instructed) in tech.

>SSD "drives"

I've literally never hear someone call it that

even from tech retards.

Because here in the land of free, people have the freedom to lie on their resumes.

its said all the time. someone who actually tries to correct another on it is too socially retarded to hold a job

Maybe I didn't want to dump 40 grand on a STEM degree and wind up in "Data Entry"

Okay, I feel like some abuse for my coding style, so I'll write some code on a touchscreen keyboard.

int isPrime (int n)
{
int i;
for (i = 2; i * i

There are people who program insurance forms who get paid 10 dollars an hour. They write in C instead of using excel and their code looks like raw sewage.

Fuck off with your expository logic. It has no place in the real world or in a business environment.

> is too socially retarded to hold a job

Good thing this is Sup Forums and no one here understands how to be social

Don't try and defend your shit English faggot.

Good solution, but the real test is how well you can walk through your code and explain each part to an interviewer, outlining inefficiencies and optimisations.

if 2 million divided by the square of the counter has no remainder?

How is that checking for prime?

>HTML scripting
Are you retarded?

>if two million divided by the value of the counter has no remainder, return the value of the counter...

2,000,000 / 3
remainder != 0
return 3

he's not retarded, just a front end dev. cut him some slack, I'm sure the web pages he styles are beautiful.

thank you.

>ask her to sum all prime numbers under 2 million
I thought you meant like doing it verbally from memory, i was like wtf you interviewing rainman lmao.

Not bad for a non-sieve solution. I might have calculated out sqrt(n) once, rounded it down, and compared against it, rather than making many integer multiplications, but this works rather nicely too.

This is less than 20 lines of code, does no complex arithmetic, and people are still complaining that summing primes is too hard for candidates to solve. I dare say, we need to make this problem the new FizzBuzz.

You don't script HTML; it's a markup language.

>You don't script HTML; it's a markup language.
Well aren't you a hep cat.
Up on all that front end lingo, are we?

Somebody still has to translate whatever the hell it is you are saying to the end user.

Who, BTW, makes more than you're yearly salary in a month and hasn't touched a word of programming in their life.

This has never happened. It's a meme you idiots.
An actual interview question would be much harder.

Guy here. I can't do this shit either and I work in tech.

Even if you've never heard of the Sieve of Eratosthenes, you can brute force it like a retard even in a slow language.
import math
sum = 0

for candidate in range(2, 2000000):
is_prime = True
for factor in range(2, math.floor(math.sqrt(candidate))+1):
if candidate % factor == 0:
is_prime = False
break
if is_prime:
sum = sum + candidate

print(sum)
On my 8 year old desktop PC:
$time python3 primes.py
142913828922

real 0m48.230s
You don't want to work anywhere where they make you use a PC this slow and it still finished in less than a minute.

Shouldn't your isPrime function use a cached list of primes (found by the function itself) to search instead of redundant checks? At present it checks i=4 when that will return the same as i=2, its lowest prime representation.

BTW, i can handle Fizz Bizz, but I don't like using multiple instances of recursion for a number of reasons.

Its processor intensive, can lock up your computer and I find it rather focus intensive, it seems to much like wrapping a wrapper in another wrapper to get to whatever it is you are trying to solve.

I get why we went from CHAR to Strings, but not why we abandoned structures and started using things like constructors in object oriented programming.

Object Constructors are really just bad code parsed poorly.

When did your applicant change genders?

I know that feel. It's pretty funny that we all get jobs from our connections and put people without connections through this gauntlet of sending their resumes to hundreds of black holes and then, occasionally, making them dance

>OK candidate, we're getting to the easy part of the interview! Find the sum of all prime numbers between 1 and n^n+1 and for every n print fuzz if it's divisible 3 and buzz if it's divisible by 5 and fizzbuzz if it is itself prime! You have around ten minutes or so and this sharpie.

Somebody with a modern CPU try this, I want to see how shit my 2.5GHz Phenon II is in comparison.

>none of the coders currently working in the office could or would do well at this and we tell him it's mandatory and simple

Can't you save yourself one iteration per prime check by noting that if i^2 = n then i is a factor of n?

Anecdotal experience?
Oh I am sure you are not committing any type of fallacy there.