4 ms·
Pre-Screen for us is simply provide working code that 'Finds the the four highest integers in a list of integers'. We accept any language. The controversial bi
by tkahnoski 14y ago
Pre-Screen for us is simply provide working code that 'Finds the the four highest integers in a list of integers'. We accept any language.
The controversial bit, is we ask for Big O of their solution.
There are a lot of candidates who didn't get the CS degree and struggle with this, surprisingly no one has ever said "I don't know Big O".
Generally, working code is enough to at least get you in the door for a face-to-face. Yet this alone filters out more than 50% of the resumes.
- deleted 14y ago[deleted]
- dpritchett 14y agoFun! Here's Ruby: def top_four_ints_from(input_list) working_set = [] input_list.each do |n| working_set.push(n) working_set.sort!.shift while working_set.count > 4 end working_set end I'm pretty sure that's O(n). Constant time to insert any one value to the working set, Roughly n sorts performed but since each individual sort covers at most five elements we're still at (5 lg 5) * n -> O(n).