Update appNew update is available. Click here to update.
About
AKGEC : Ajay Kumar Garg Engineering College 2025
My Stats
EXP gained
yellow-spark
1940
Level
5 (Champion)
Community stats
Discussions
0
Upvotes
1
Know more
35
Total problems solved
32
Easy
3
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

7 days

Less

More

Discussions
Java Solution
Interview problems
public static void getNumberPattern(int n) {
        int change=n;
        for (int i=0; i<n; i++) {
            for (int j=0; j<2*n-1; j++) {
                if (j!=0 && j<=i) change--;
                else if (j >= 2*n-1-i) change++;
                System.out.print(change);
            }
            System.out.println();
        }
        change=n;
        for (int i=n-2; i>=0; i--) {
            for (int j=0; j<2*n-1; j++) {
                if (j<=i && j!=0) change--;
                else if (j >= 2*n-1-i) change++;
                System.out.print(change);
            }
            System.out.println();
        }
    }
profile
Pranav Bisaria
Published On 25-Nov-2023
44 views
0 replies
1 upvotes