diff --git a/8 May Missing element of AP b/8 May Missing element of AP new file mode 100644 index 0000000..d0e090a --- /dev/null +++ b/8 May Missing element of AP @@ -0,0 +1,29 @@ +class Solution { + public: + + int findMissing(vector &arr) { + // code here + int diff=arr[1]-arr[0]; + + if(diff>0){ + for(int i=1;id) return arr[i]-d; + else if(diffd) return arr[i]+diff; + } + + } + return *(arr.end()-1)+diff ; + } +};