Problem link: https://www.hackerearth.com/problem/algorithm/jon-and-ramsay-60/description/ Code Link: https://ide.codingblocks.com/s/53599