optimize the boundary of second loop which improve performance by 50%
add ruby solution to q004