MidExamRetake_April_2019 03. Easter Shopping
Не мога да си открия грешката, judge Ми дава 80/100
https://pastebin.com/mFcQnH39
Не мога да си открия грешката, judge Ми дава 80/100
https://pastebin.com/mFcQnH39
When comparing with my C#-version for the exam, try you to modify your indeces that are used for the placeShop method.
Best,
C# variant:
else if (command == "Place")
{
string shop = commandData[1];
int index = int.Parse(commandData[2]);
if (index >= 0 && index < stores.Count - 1) // Here is the difference
{
stores.Insert(index + 1, shop);
}
}
JAVA variant:
if (number < shops.size() - 1 && number > 0) { // New indeces
shops.add((number+1),command);
}
За съжаление пак дава 80/100(Java), проблемът остава.
Try to change as well:
private static void visitFirstNumberOfShops(List<String> shops, String command, int number) {
if (0<number&&number < shops.size()) {
for (int i = 0; i < number; i--) { // change here
shops.remove(0); // change here
}
}
}
Best,
Yes!!!
https://pastebin.com/g9vBNbVG
This method was the problem:
}
}