1d and 2d array peak finding