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

Timeout for Minimum_Swaps_2 #2

Open
YohanAvishke opened this issue Mar 19, 2019 · 0 comments
Open

Timeout for Minimum_Swaps_2 #2

YohanAvishke opened this issue Mar 19, 2019 · 0 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested

Comments

@YohanAvishke
Copy link
Owner

Test cases from 10 to 14 timeouts in HackerRank for current solution

@YohanAvishke YohanAvishke added bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Mar 19, 2019
@YohanAvishke YohanAvishke self-assigned this Mar 19, 2019
Diamond-Dust added a commit to Diamond-Dust/HackerRank-Solutions that referenced this issue Apr 3, 2019
Original solution worked in O(n^2) time, while this one should work in O(n). 
We organise the values into multiple cycles of swaps to be done. Number of needed swaps is a sum of the cycle sizes with each decreased by one (because it is a cycle after all).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant