Take a look on the history that is being printed by my solution :
81 …
91 …
101 …
But is being accepted.
Take a look at my implementation → Shell-Java/src/main/java/context/ConsoleState.java at master · i27ae15/Shell-Java · GitHub
This is my current code:
public void printHistory(int limit) {
int i = 0;
if (limit != -1) i = history.size() - limit;
for (; history.size() > i; i++) {
utils.Printer.println(" " + String.valueOf(i + 1) + " " + history.get(i));
}
}
if you replace that print with :
for (; history.size() > i; i++) {
utils.Printer.println(" " + i + 1 + " " + history.get(i));
}
It makes the printing of that extra 1.