3 ms·
“Write a function that finds the longest positive-sum subsequence in an int array and runs in O(n) time.” That's a horrible interview question. If you know th
by fsk 13y ago
“Write a function that finds the longest positive-sum subsequence in an int array and runs in O(n) time.”
That's a horrible interview question. If you know the trick (saw the question before), it's easy. If you don't know the trick, it isn't reasonable to expect someone to figure it out in 5-15 minutes.
That's a brainteaser question disguised as an algorithms question.
- d3gamer 13y agoBut there isn't really a "trick" here, though. The point of these questions is to figure out if the candidate has enough CS fundamentals to construct a reasonable solution to a problem that they've never seen before.
- fsk 13y agoThere is a trick. Loop over the array, remembering the maximum and minimum. If you've seen it before, the question is MUCH easier, making it a bad question.