fixed solution of Detecting Cycles challenge

There was a mistake in the first loop of Floyd and Brent, incorrectly using the
"endsIn" method, where it was supposed to be a "contains".

Also modified the object companions of Floyd and Brent, since it's cleaner to
just have the default factory (via case class) instead of directly calling the
"findCycle" method also with it.