Files
2026-01-25 12:44:50 +05:30

16 lines
446 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
One pass:
one pass starts from index 0 and stores it in a map,
and for next number in array,
it computes the new complement and checks if its present in map,
if yes then prints
else stores the original number in hash and continues
Two pass:
Two-pass hash table solution first builds a map of all values to their indices,
then makes a second scan through the array to compute each elements complement
and check if it exists in the map.