Beyond Petals interview question

maths