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

Solution for Q_04_24 is wrong #53

Open
dash-anurag opened this issue Oct 4, 2020 · 0 comments
Open

Solution for Q_04_24 is wrong #53

dash-anurag opened this issue Oct 4, 2020 · 0 comments

Comments

@dash-anurag
Copy link

dash-anurag commented Oct 4, 2020

The solution for Q_04_25 is incorrect. The code gives wrong output for:
first City = Chicago
second City = Los Angeles
third City = Atlanta

Correct Logic:

        if ( first.compareTo(second) > 0) {
            temp = first;
            first = second;
            second = temp;
        }

        if( first.compareTo(third) > 0) {
            temp = first;
            first = third;
            third = temp;
        }

        if( second.compareTo(third) > 0 ) {
            temp = second;
            second = third;
            third = temp;
        }
@dash-anurag dash-anurag changed the title Solution for Q_04_25 is wrong Solution for Q_04_24 is wrong Oct 8, 2020
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

1 participant