a constant space and one pass solution