Initialize min and max using last two elements
min = 0 ; max = 0 NEW_LINE if pre [ size - 1 ] > pre [ size - 2 ] : NEW_LINE INDENT max = pre [ size - 1 ] NEW_LINE min = pre [ size - 2 ] NEW_LINE DEDENT else : NEW_LINE INDENT max = pre [ size - 2 ] NEW_LINE min = pre [ size - 1 ] NEW_LINE DEDENT