3 ms·
Another piece of advice: Think carefully and don't assume that the obvious algorithm is the best one. Interviewers will usually be satisfied if you notice that
by cperciva 14y ago
Another piece of advice: Think carefully and don't assume that the obvious algorithm is the best one. Interviewers will usually be satisfied if you notice that they're describing an instance of 3SUM and give them the obvious O(n^2) solution; they'll be impressed if you notice that the problem they're describing is actually a dense special case and can be solved faster using an FFT-based convolution.