diff --git a/missingNumberInArray.cpp b/missingNumberInArray.cpp new file mode 100644 index 0000000..7074dc0 --- /dev/null +++ b/missingNumberInArray.cpp @@ -0,0 +1,38 @@ +/*find the smallest positive number missing from the array*/ + +#include +using namespace std; +typedef long int li; +typedef long long int ll; +int main() + { + + li n; + cin>>n; + ll a[n],max=0; + for(li i=0;i>a[i]; + if(a[i]>max){ + max=a[i]; + } + } + ll b[max+1]={0}; + for(ll i=0;i0){ + b[a[i]]++; + } + } + int c=0; + for(ll i=1;i +#include +using namespace std; +const long long M = 1e9+7; +long long int p(long long int n,long long int r){ + if(!r) + return 1; + long long int t = p(n, r/2); + if(r%2==1) + return (n * ((t*t)%M)) %M; + return (t*t)%M; +} + +int main() { + + long int N=12,sum=0; + int l=log10(N); + long int x=N; + for(int i;x>0;i++){ + long int temp=0; + temp=x%10; + x=x/10; + sum=sum+temp*pow(10,l--); + } + cout<