diff --git a/algorithms/CPlusPlus/Arrays/specialindex2.cpp b/algorithms/CPlusPlus/Arrays/specialindex2.cpp new file mode 100644 index 00000000..f542d92d --- /dev/null +++ b/algorithms/CPlusPlus/Arrays/specialindex2.cpp @@ -0,0 +1,65 @@ +/* +@author: nandinisahu407 +special index-> if after deleting element from index i , sum of even index=sum of odd index +approach-> +after deleting ,previous element at odd index will be now at even index and vice versa +s_odd= odd[0 to i]+ even[i+1 to len] +s_even=even[0 to i]+odd[i+1 to len] + +*/ +#include +using namespace std; + +int main(){ + int num; + cout<<"enter length"<>num; + vector arr (num); + + for(int i=0;i>arr[i]; + } + + int count=0; + int s_even,s_odd; + for(int i=0;i