Cyient Interview Question

Given a logical problem to solve through coding