Toppan Ecquaria interview question

Programming test was given, not difficult.