And come up with “The Worst Coding Problem Ever” dun dun dun!
Imagine getting this whopper in an interview or a take home test:
The United States has been conducting a census once a decade for over 200 years.
Imagine you can iterate the data at a family level, with the family data being whatever format/object is easiest for you.
Find the family with the longest fibonacci sequence of children.
The most fundamental issue is that it’s not clear what the answer looks like. In fact, the 4 of us had 3 different interpretations of what the answer would look like.
Is the question looking for children’s ages going forward?
That would be an age sequence of 0, 1, 1, 2, 3, 5, etc
Or a newborn, a pair of 1 year old twins, a 2 year old, 3 year old, 5 year old, etc
Or is it looking for children born in the sequence? (This is the inverse of the first answer)
A 6 year old, 5 year old twins, a 3 year old and a newborn
Or is it asking about the age gap between children?
In that case you’d be hunting for Twins (gap of 0), a gap of 1 year, a second gap of 1 year, a gap of 2 years, etc.
There are so many ways to be the family fibonacci.
Many Technical Problems are like this
Fairly straightforward computer problems with meaningless mathematics sprinkled on top. Being asked by people who won’t know the implications of any of the 3 answers.
But what’s the answer?
If you are presented with this question in an interview, the correct answer is to thank the interviewer for their time, wish them the best of luck in their search, and end the interview.