Samsung Electronics Interview Question

Solve a difficult coding challenge