Time and Space complexity

int fact=1;              //fact=4 byte
for(int i=1;i<=n;++i) //n=4 byte
{
fact *=i; //i=4 byte
}
return fact; //aux space =4 byte
//space=16 byte
int count = 0;
for (int i = 0; i < N; i++)
for (int j = 0; j < i; j++)
count++;

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store