My code is perfectly runs well, best test case failed and also please explain about constaints.
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int nst = 1;
int row = 1;
while (row <= n) {
for (int cst = 1; cst <= nst; cst++) {
if (cst == 1 || cst == nst) {
System.out.print(row);}
else {
System.out.print("0");}
}
System.out.println();
nst++;
row++;
}
}
}