3 ms·
Five hours and no one has actually attempted to answer the question as far as I can tell. If I was Mary I would probably want A. As a programmer I would tend t
by zwkrt 4y ago
Five hours and no one has actually attempted to answer the question as far as I can tell.
If I was Mary I would probably want A. As a programmer I would tend toward C becuase I have been burned by not questioning requirements before. If Mary were me (so to speak) I would hope she asked me such questions, but most people giving requirements get annoyed with too much hair splitting, at least hair splitting from their perspective.
- jamesrom 4y agoI like A, as it iterates toward C anyway. You can deliver value with the naïve implementation delivered quickly. If Mary Jones has further requirements that were not considered at the outset, now she'll be able to consider them. Conversely, if you've built a bunch of assumptions into your code, they'll be tested in the real world sooner rather than later.
- zeristor 4y ago“Just go away and write the code”
- samuel 4y agoA) is the right *business* answer the 99% of the time, assuming you have a fast routine for sorting an array but not one for computing the median directly. Mary shouldn't care about a) vs b) unless she has to wait too much to get the answer. If she has, then her need has to be weighted against other business needs, so the data gathered in c) becomes relevant. b) then becomes one of c's aftermaths. d) is dishonest So it is a) -> c) I wouldn't go directly to c), a) is cheap enough.
- mattkrause 4y agoI'd cheat in a slightly different way. If the data are employee ages, you know that they are probably integers[0] and certainly bounded between 0 and 128. Bin the ages into years and accumulate the per-year and total counts, which is a snap: O(N) time, O(1) space, and trivial to parallelize. Find the bin where the cumulative sum is equal to half the total counts and you're done. [0] Even if they're not integers, you probably don't need ages more granular than a day, which is still a manageable number of bins (~50k).