I am working on a practice problem at CodeSignal; problem link
I came up with two suitable approaches to solve this problem, am sure there can be more.