Implement SGD for linear regression and derive gradients | Amazon Interview Question