Write the logistic regression loss function | Apple Interview Question