How Two Sigma's process runs, as candidates and the firm describe it, and the questions candidates report, each with a worked solution. Free, no sign-up.
Try each one before opening the solution. Interviewers change the numbers, so learn the method.
Quantitative Researcher · Online assessment · Regression · reported by a candidate
Implement linear regression without an intercept, y ≈ βx: first on a batch of data, then on streaming data where points arrive one at a time.
Practice (ours): for the points (1, 2), (2, 3), (3, 7), what is β? (our follow-up)Answer and worked solution
Answer: 29/14 ≈ 2.0714
Key idea. With no intercept, least squares gives β = Σxy/Σx².
Σxy = 1·2 + 2·3 + 3·7 = 2 + 6 + 21 = 29.
Σx² = 1 + 4 + 9 = 14.
β = 29/14 ≈ 2.07.
Check. The points rise roughly 2 for each 1 in x, so β ≈ 2 makes sense.
Trap. For streaming, recomputing from all data each time. Instead keep running sums Sxy and Sxx and update them in O(1) per point.
Interviewers may push further: How would you make it numerically stable? How would you down-weight old data (exponential forgetting)? What goes wrong if x is nearly constant?