Counting(0, n, ll); // i.e. we have write from 0 to 1000 in lexicographic order. System.out.println(ll); public static void Counting(int curr, int n, List<Integer> ll){ // curr means current i.e.