ServiceNow Interview Question

Typical DS, Algo and some good puzzles