systemic emotions
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1,2,3,4 are 3 unique elements ?
- systemic emotions August 06, 2013Comment hidden because of low score. Click to expand.
0
of 0 vote
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<endl<<"enter n:";
cin>>n;
int a[n][n],i,j,m;
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
a[i][j]=(i*n)+(j+1);
}
}
if(n%2==0)
m=n/2;
else
m = (int) n/2+1;
for(int k=0;k<=m;k++)
{
cout<<endl;
for (j=k;j<n-k;j++)
{
i=k;
cout<<"\t"<<a[i][j];
}
cout<<endl;
for(i=k+1;i<n-k;i++)
{
j=n-1-k;
cout<<"\t"<<a[i][j];
}
cout<<endl;
for(j=n-2-k;j>=0+k;j--)
{
i=n-1-k;
cout<<"\t"<<a[i][j];
}
cout<<endl;
for(i=n-2-k;i>=1+k;i--)
{
j=0+k;
cout<<"\t"<<a[i][j];
}
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
But the question is not to check if the point is inside or outside , " Find if the point is one of the vertices of the polygon in O(log N) time.. " ?? Please correct me if I m wrong .
- systemic emotions November 30, 2013