From 353aa49e310b54de9f3ea048d885f0dc58633161 Mon Sep 17 00:00:00 2001 From: Shivam Jaiswal Date: Sun, 24 Jul 2022 22:07:25 +0530 Subject: [PATCH] two sum add --- Data Structures/Arrays/two_sum.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Data Structures/Arrays/two_sum.cpp diff --git a/Data Structures/Arrays/two_sum.cpp b/Data Structures/Arrays/two_sum.cpp new file mode 100644 index 0000000..bc10a4b --- /dev/null +++ b/Data Structures/Arrays/two_sum.cpp @@ -0,0 +1,20 @@ +#include +#include +using namespace std; +int main(){ + int arr[] = {2,3,4,9,1,0,6,10,23,5,76}; + int n = 11; + int target = 7; + unordered_map seen; + for(int i=0;i