Nokia interview question

Write Matlab code to solve a simple problem