Hackerrank Challenges - Utopian tree

(CM: use modulo math for this)