Ashika interview question

Mathematical analysis and a coding question