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

Update getSecondHighestPriceByBrand.java #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

burrasaiteja21
Copy link

Fixed the second highest price logic:

Before, it only returned the first matching brand, but now it finds all matching footwear, sorts them by price, and returns the second highest one. Added sorting:

I used a list to collect matching footwear, then sorted them by price from highest to lowest to get the correct result. These changes ensure that the program works as expected, especially when finding the second highest priced footwear for a brand.

Fixed the second highest price logic:

Before, it only returned the first matching brand, but now it finds all matching footwear, sorts them by price, and returns the second highest one.
Added sorting:

I used a list to collect matching footwear, then sorted them by price from highest to lowest to get the correct result.
These changes ensure that the program works as expected, especially when finding the second highest priced footwear for a brand.

Signed-off-by: Burra Saiteja <[email protected]>
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