It's related to the normal reaction force, which can only act in the direction AGAINST the surface (assuming it's a simple smooth surface, not velcro)
For inside loop (at the top),
(they act int the same direction), however, when the required centripetal acceleration is LESS than g [that is,
], it implies N must be negative. This is impossible as N can only act downwards. Hence the object is not in contact with the surface. The minimum velocity is
For outside loop (at the top),
(mg acts downwards, N acts upwards). However, when centripetal acceleration is GREATER than g [that is,
], it implies N must be negative. This is impossible as N can only act upwards, Hence the object is not in contact with the surface (it launches off the surface like in racing games). The maximum velocity to maintain contact with the surface is