less operations for add one to each array

just add the array length at the end instead of one each time