Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if condition wrong #22

Open
kumarqwe opened this issue Jun 24, 2023 · 1 comment
Open

if condition wrong #22

kumarqwe opened this issue Jun 24, 2023 · 1 comment

Comments

@kumarqwe
Copy link

///where the limit int is lesser than or equal to the original array of Inventory object's threshold attribute.

public static Inventory[] replenish(Inventory[] inventories, int limit){
Inventory[] refined = new Inventory[0];
for (int i = 0; i < inventories.length; i++){
if (inventories[i].getThreshold() <= limit){ ///// change to (inventory[i].getThreshold() >= limit)
refined=Arrays.copyOf(refined, refined.length+1);
refined[refined.length-1] = inventories[i];
}
}
return refined;
}

@venkivijay
Copy link
Owner

Hey @kumarqwe, Glad you found this issue. Would you be willing to raise a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants