Any easier way to solve the problem ALOR7?

Problem: ALOR7
My solution: click here

My solution is too complex to implement. Is there any easier way to solve this problem?