Dolby interview question

a maths problem and 2 programming problem.