Java-Solutions-TCS-Xplore-Proctored-Assessment
Java-Solutions-TCS-Xplore-Proctored-Assessment copied to clipboard
if condition wrong
///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; }
Hey @kumarqwe, Glad you found this issue. Would you be willing to raise a PR for this?