Ruby Array Reduce Method Javascript Interviewbit Interview