Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

FamDav posted:

for coding competency i like these two questions:

1) you're given a set containing a dictionary of words, starting word, and an ending word. provide me a word ladder from the starting word to the ending word.

a word ladder in this case is a a sequence of words that transforms the starting word into the ending word by only changing one character at a time. for example, if start is head and end is tail

head
heal
teal
tell
tall
tail

if they do one method of solving this quickly, i ask them if they can come up with another. if they use a queue, do it with recursion; recursion, use queue. if they do both, talk about how to make the queue version faster (2-sided bfs, a*).

2) implement a basic regular expression handler. you should be able to handle regular expressions that match combinations of the following rules. assume all regular expressions passed are well formed and all strings passed contain 0 or more literals.

- a literal (a-zA-Z0-9)
- a literal followed by a *, that takes 0 or more instances of the literal
- a literal followed by a +, that takes 1 or more instances of the literal
- a literal followed by a | followed by another literal, indicating that one of the two literals must match.
- a [ followed by a sequence of literals followed by ], indicating a set of literals that can be matched. should be treated as a literal for all other operators. a []-set cannot be inside another []-set.

i give out the first two rules and then add on as time permits. I like to ask about test cases, see what they think about how * and + should work, see how they handle refactoring for the the new rules, and also talk about what kind of bugs would occur if the regular expressions werent well-formed.


are these good or bad questions rotor i need your validation :(

how many people took a big poo poo on your desk when you asked them this because that would be my first instinct

Adbot
ADBOT LOVES YOU

Brain Candy
May 18, 2006

hobbesmaster posted:

I want to smack whoever popularize the pointer swap w/o a temporary trick question

the only time i've seen xor swap in the wild was for some ancient c

this was the implementation
code:
x^=y^=x^=y;
hmmmmmmm, why didn't this code produce the same results with the new compiler, hmmmmmmmmmmmmm

Bloody
Mar 3, 2013

Brain Candy posted:

the only time i've seen xor swap in the wild was for some ancient c

this was the implementation
code:
x^=y^=x^=y;
hmmmmmmm, why didn't this code produce the same results with the new compiler, hmmmmmmmmmmmmm

lolll

hobbesmaster
Jan 28, 2008

Bloody posted:

1 weird trick to save... a register*


*maybe

xchg eax, ebx

but if the compiler understands what you're doing it can cost nothing

Bloody
Mar 3, 2013

hobbesmaster posted:

xchg eax, ebx

but if the compiler understands what you're doing it can cost nothing

look @ this guy w/ his fancy pants x86 instructions

tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

reimplementing basic functionality of std libraries or os utilities is a massive red flag that you're being interviewed by plangers

can you demonstrate mastery of a tool by means of reimplementing a highly simplified version.

when the basic functionality is very similar to the system you are writing, this is a good interview task

for ex: you are doing a lot of text processing or text extraction and ask people to implement regex because they'll be doing it all day every day

Bloody
Mar 3, 2013

i can write good c but don't expect me to write a compiler

i can write decent assembly but don't expect me to design a cpu

Bloody
Mar 3, 2013

my job: take every advantage modern tools offer to reduce my own work burden

interview question: reimplement basic tool functionality

yep this maps well

MeruFM
Jul 27, 2010
common library reimplementation is a decent way of figuring out a person's ability to check edge cases, because there's always a million in generic libs

tef
May 30, 2004

-> some l-system crap ->

Bloody posted:

i can write good c but don't expect me to write a compiler

i can write decent assembly but don't expect me to design a cpu

i was not suggesting you reimplement your compiler, well, that is unless you're interviewing for a compiler job

i was asked to reimplement a simple version of wget for a job where i had to write a web crawler.

if you can, boiling down the problem you expect them to be doing into a small task, can be good.

this is different from the basic "can you code an algorithm" competency screeners

suffix
Jul 27, 2013

Wheeee!
i like doing the toy problems :kiddo:
but i think it would be pretty hard to get a job where you did them regularly

like maybe if people would just call me and say "help i want to do this with a million items but it is too slow",
and i could just come and say "hmmmm" and find a rly smart way to do it. that would be pretty nice i think.

e: and i could have a funny image macro with "sorry, it's np complete" that i would post if i couldn't make it fast

suffix fucked around with this message at 00:48 on Nov 1, 2014

tef
May 30, 2004

-> some l-system crap ->
and sometimes, the domain in which you work overlaps heavily with a common tool or library

MrMoo
Sep 14, 2000

Brain Candy posted:

the only time i've seen xor swap in the wild was for some ancient c

this was the implementation
code:
x^=y^=x^=y;
hmmmmmmm, why didn't this code produce the same results with the new compiler, hmmmmmmmmmmmmm

For shits and giggles I added a XOR swap to my code to permanently sit there disabled by a macro:

code:
#ifdef USE_XOR_SWAP
/* whilst cute the xor swap is quite slow */
#define SWAP(a, b)      (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
#else
#define SWAP(a, b)      do { const pgm_gf8_t _t = (b); (b) = (a); (a) = _t; } while (0)
#endif
https://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/reed_solomon.c#136

JewKiller 3000
Nov 28, 2006

by Lowtax

suffix posted:

i like doing the toy problems :kiddo:
but i think it would be pretty hard to get a job where you did them regularly

it's called academia

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

JewKiller 3000 posted:

it's called academia

rack them.

Plastic Snake
Mar 2, 2005
For Halloween or scaring people.
my last interview question was "design a parking lot" and I wrote out some classes and interfaces and we talked through the problem together and thought about caveats and stuff. it was a good question because it's open ended and can get as technically involved as you want/need

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Plastic Snake posted:

my last interview question was "design a parking lot" and I wrote out some classes and interfaces and we talked through the problem together and thought about caveats and stuff. it was a good question because it's open ended and can get as technically involved as you want/need

that ones not bad. i'm gonna steal it i think

MrMoo
Sep 14, 2000

Don't you just grab a piece of paper and draw lines for the cars? :confuoot:

MononcQc
May 29, 2007

tef posted:

for ex: you are doing a lot of text processing or text extraction and ask people to implement regex because they'll be doing it all day every day

I'm kind of glad I didn't have to implement support for trailers as an interview question though.

CPColin
Sep 9, 2003

Big ol' smile.
I don't know if we still have it, but we at least used to have an interview question that looked like this:

code:
public boolean hasValue(Collection<?> collection, Object value)
{
   boolean hasValue = false;
   Iterator<?> iterator = collection.iterator();

   while (iterator.hasNext())
   {
      if (iterator.next().equals(value)
      {
         hasValue = true;
      }
   }
   
   return hasValue;
}
Then we'd ask how the person would improve that loop. They passed the test if they said, "Just return true when you find the value."

Some people suggested adding the values to a map or sorting them and doing a binary search.

One guy finally said, "Isn't there already a Collections.contains() method?" I liked that guy.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

MrMoo posted:

Don't you just grab a piece of paper and draw lines for the cars? :confuoot:

that's a nub mistake, the pros will always make sure they bring some Hot Wheels

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
I wish I was ever asked interview questions like those but they never call dudes without computer degrees to interviews here where I live lol owned

hobbesmaster
Jan 28, 2008

Blinkz0rz posted:

that ones not bad. i'm gonna steal it i think

that one is in a book or something I've read it as a recommended object oriented test

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

hobbesmaster posted:

seriously

like there was that Amazon interviews post where one of the problems was "how do you find and change phone numbers at the bottom of every webpage?"
correct answer: "uh, grep"

Did not deal with any bullshit questions like this in my Amazon interview, but they were five 40 minute interviews back to back which as pretty grueling.

One of the guys who did the whole open ended question of here's a real problem I had, how would you solve it? I really liked the stuff he was working on but his team wasn't hiring, he was just the control to make sure the actual hiring teams weren't being biased in their selection (too easy or too hard).

Two of them asked me mostly soft questions about my experience but they both asked at least one technical questions from the standard poo poo:
How to get the Nth element from the end of a linked list?
How to get the depth of a tree?

The other two interviewers were obviously devs:

One of them gave me the question of here is an array of integers in the range 0..n but one is missing (replaced with a 0), return which number it is. I knew the answer from studying up on typical interview questions, and so they asked for the follow up harder question of there being two numbers missing. Apparently there is a way to calculate it see this if you care http://stackoverflow.com/q/3492302/102483 but I said in that case I'd just sort the array in O(n log n) which is close enough to the O(n) you have to do anyways and return the two non consecutive numbers and called it a day. They were satisfied with that and then actually asked a decent design question about how I would make my own Photoshop clone and the necessary abstractions I would use to make it work.

The last guy posed a fun question about how I would solve the problem of given a string with a message and another string with a bunch of letters to write a function that would return whether the message could be created from the String of characters. I came up with a crappy algorithm, and then talked about how to optimize it and I actually did find a significant improvement without any prodding. Then we went on to discuss the more general problem of trying to do that same thing with multiple clients trying to figure out if their message could be formed from the same bank of letters and had some cool concurrency discussions.

tldr; I guess I got lucky?

Janitor Prime fucked around with this message at 06:53 on Nov 1, 2014

syntaxrigger
Jul 7, 2011

Actually you owe me 6! But who's countin?

Plastic Snake posted:

my last interview question was "design a parking lot" and I wrote out some classes and interfaces and we talked through the problem together and thought about caveats and stuff. it was a good question because it's open ended and can get as technically involved as you want/need

I love these type of questions because it presents a problem I can sperg out about without my brain hitting the panic button

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

rotor posted:

that's a nub mistake, the pros will always make sure they bring some Hot Wheels

roll into an interview with a brief case full of hot wheels, a jar of jelly beans with a correct count, a table of common objects and how many ping pong balls they contain, and a list of all the piano tuners in manhattan

hobbesmaster
Jan 28, 2008

Cocoa Crispies posted:

roll into an interview with a brief case full of hot wheels, a jar of jelly beans with a correct count, a table of common objects and how many ping pong balls they contain, and a list of all the piano tuners in manhattan

but what if I get asked to move Mount Everest?!

hobbesmaster
Jan 28, 2008

from the snack overflow link:
I had never seen/heard/considered this variation before, so I panicked and couldn't answer the question. The interviewer insisted on knowing my thought process, so I mentioned that perhaps we can get more information by comparing against the expected product, or perhaps doing a second pass after having gathered some information from the first pass, etc, but I really was just shooting in the dark rather than actually having a clear path to the solution.

uh, panic at something new? well that question worked incredibly well.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

hobbesmaster posted:

from the snack overflow link:
I had never seen/heard/considered this variation before, so I panicked and couldn't answer the question. The interviewer insisted on knowing my thought process, so I mentioned that perhaps we can get more information by comparing against the expected product, or perhaps doing a second pass after having gathered some information from the first pass, etc, but I really was just shooting in the dark rather than actually having a clear path to the solution.

uh, panic at something new? well that question worked incredibly well.

there's the old joke about the first grader who knows how to subtract spoons from things but not forks

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

FamDav posted:

are these good or bad questions rotor i need your validation :(

why are people so obsessed with data. most programming I do deals with states, data is incidental. even then the most important aspects of data in my day to day work are lifetime, ownership and mutable vs immutable, not format. I used to obsess over performance too but nowadays who cares, I'll just go O(n) and maybe some day ask a profiler if I should bother optimizing

personally, when my boss asked for suggestions about interview questions, I told him to make them read code. explain what this code does, fix the bug in this code, implement this new feature, etc.

Plastic Snake
Mar 2, 2005
For Halloween or scaring people.

syntaxrigger posted:

I love these type of questions because it presents a problem I can sperg out about without my brain hitting the panic button

yeah it was a really enjoyable interview. I took the job and my team owns.

I've since used it to interview newer candidates and it's really interesting to see the different ways people approach the problem.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Janitor Prime posted:


One of them gave me the question of here is an array of integers in the range 0..n but one is missing (replaced with a 0), return which number it is. I knew the answer from studying up on typical interview questions

and this is probably my number one reason why those interview questions suck

FamDav
Mar 29, 2008

rotor posted:

and this is probably my number one reason why those interview questions suck

the worst part of this question is:

okay, what if 2 numbers are missing? maybe you figure it out and then you do out the math to figure out the two numbers.

okay what if k numbers are missing? shut the gently caress up. you never actually implemented the solution, because its actually a fairly nuanced solution.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
no, the worst part is that the ability to answer this sort of contrived bullshit is the gateway to a lot of engineering organizations.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
if I can successfully study for your interview, then your interview is garbage.

JewKiller 3000
Nov 28, 2006

by Lowtax
interviews that can be studied for will simply single out the candidates with the most interviewing experience, which is probably not who you want to hire

BONGHITZ
Jan 1, 1970

what if i answer i dont know to every question?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

then you will never get job

Asymmetric POSTer
Aug 17, 2005

lol if every interview youve ever had isnt a casual conversation with one or two people you'll be working with followed quickly with salary negotiation

this thread is making me realize how dumb i am tho, thank god im not trying to be a programmer :smithicide:

Adbot
ADBOT LOVES YOU

Bloody
Mar 3, 2013

FamDav posted:

the worst part of this question is:

okay, what if 2 numbers are missing? maybe you figure it out and then you do out the math to figure out the two numbers.

okay what if k numbers are missing? shut the gently caress up. you never actually implemented the solution, because its actually a fairly nuanced solution.

Generate a list of all numbers 0...n and subtract one list from the other? How is this hard?

  • Locked thread