Roy and Profile Picture -- Hackerearth

Solution : 

The tricky part of the problem is  "Minimum dimension......."