Difficulty: Easy Tags: Regression
A lightweight linear model relating post length to engagement is the very first thing a new content-ranking hire implements at Meta: a rite of passage, and a correctness bar every later ranking model gets compared against.
w = sum((x_i - mean_x) * (y_i - mean_y)) / sum((x_i - mean_x)^2)
b = mean_y - w * mean_x
n
x_1 y_1
...
x_n y_n
w b, 6 decimals.
2 <= n <= 10^5Input
5
1 50
2 55
3 65
4 70
5 80
Output
7.500000 41.500000
No results yet
Run your code to check it against the examples, or submit to run every test.