Q2: Visit idle-tyme.com and implement that type of clock as a function.
Sigiloso
I wrote this from what I remembered from the interview, i should have copy pasted but i realized as soon as i closed my hackerrank console, it might be one or two small omissions but here's the code similar to what i implemented. unordered_map m { {0, 4}, {1, 11}, {2, 11} }; vector levels {0, 0, 1}; void tick(vector &levels, int level) { if (level >= levels.size()) return; if (levels[level] >= m[level]) { levels[level] = 0; tick(levels, level+1); } else { levels[level]++; } }