Leetcode day1

This commit is contained in:
2026-01-25 12:41:33 +05:30
parent 686d174f19
commit 245116d181
14 changed files with 168 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
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.