Solution to six hump camel back back problem implemented in ruby