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
|
1055 Discussions
|
Please Login in order to post a comment
i have used some conditions and a variable which is inc-dec .. how do you see this solution?
int a;
At first, I created the matrix for the first quadrant and used a lot of lines to print it in order and reverse order. But later, I saw that the AI's code was much more concise. That's when I realized the pattern: the value of each element is n - d, where d is the minimum distance from the element to the matrix boundary.
Here is Printing patterns using loops solution in c - https://programmingoneonone.com/hackerrank-printing-pattern-using-loops-in-c-solution.html
include
include
include
include
int main() {
}
I have a solution which is way faster and more simple than using the array
include
include
include
include
int main() {
}