Problem 21 of Array Custom solution