Solucion: a la de ameRiK@nO
import java.util.ArrayList;
import java.util.Scanner;
public class t {
public static void main
(String[] args
) { Scanner scanner
= new Scanner
(System.
in); System.
out.
println("Ingrese N:"); int p = scanner.nextInt();
ArrayList<Integer> arrayList = new ArrayList<Integer>();
int i= 0;
for(int index=1;index<=p;index++){
arrayList.add(index);
for(int j=index;j<=p;j++)
arrayList.add(i);
System.
out.
println(arrayList
); for(int l=index;l<=p;l++)
arrayList.remove(index);
}
}
}
Consola
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 6, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 6, 7, 0, 0, 0]
[1, 2, 3, 4, 5, 6, 7, 8, 0, 0]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
Saludos y bueno espero otro ejercicio