We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Printing Pattern Using Loops
Printing Pattern Using Loops
Sort by
recency
|
1051 Discussions
|
Please Login in order to post a comment
I have a solution which is way faster and more simple than using the array
include
include
include
include
int main() {
}
how do you see this solution
So I am going to leave a hint that helped me out but doesn't completely give it away.
You can think that you are subtracting out the distance in grid cells that you are away from the closest "wall" or side of the box.
I was just trying to think wired and it worked lol ( a beginnner) .
int main(){ int n, x , xt = -1; scanf(" %d",&x); n = 2*x -1; int yt = n; int arr[n][n];
for(int i = 0; i < n ; i++){
}
}
include
include
include
include
int main() { int n,i; scanf("%d", &n); int size = 2*n-1; int a[size][size];
}