Epicor Software interview question

coding from hackerrank