# Aastha ```cpp! Find max sum in the array. - every number pick, ith, cannot pick i-1th index and i+1th index number [1, 2, 3, 4, 5] - (1, 3, 5) = 9 [1, 2,-3, 4, 5] - (2, 5) = 7 //i int findMax(vector<int>&arr){ int option1=0; int sum=n*(n+1)/2; vector<int>index; for(int i=0;i<arr.size();i++){ if(contains(index)){ option2-=arr[i]; } else{ option1+=arr[i]; } index.push_back(i); ans=max(option1,option2); } } ```