Amazon Interview Question

Loss functions, leetcode medium question.