Check if the calculated value res is present in array , then mark c = 1 and if c = 1 return res else res must be - ve
if c == 1 : NEW_LINE INDENT return res NEW_LINE DEDENT else : NEW_LINE INDENT return - res NEW_LINE DEDENT