Skip to content

Comments

Incorrect output#30

Open
pranavyatnalkar wants to merge 5 commits intoharpoonix:mainfrom
pranavyatnalkar:incorrect-output
Open

Incorrect output#30
pranavyatnalkar wants to merge 5 commits intoharpoonix:mainfrom
pranavyatnalkar:incorrect-output

Conversation

@pranavyatnalkar
Copy link

@pranavyatnalkar pranavyatnalkar commented Oct 14, 2022

!bought[boughtIndex] was incorrect. This condition is checking if the item already assigned to the customer is sold. But since initially the customer is assigned the cheapest item, the condition may always remain false (in the case when cheapest item is sold in previous rounds of the auction). Hence, all the following customers never get assigned a new item (in fact all of them get the cheapest item).
We need to check whether the item we are about to sell to the customer is sold or not.
Correction: !bought[j]

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

Successfully merging this pull request may close these issues.

1 participant