Problem 19 and 20 for arrays with custom solution