Group by imterval

This is the answer that I present for the test. Best regards