We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
New Year Chaos
New Year Chaos
Sort by
recency
|
1938 Discussions
|
Please Login in order to post a comment
I've implemented a simple lookahead building upon @princealonte solution after noticing you only need contextual information from 3 adjacent values that you compare from the current index.
We just have to update the lookahead values depeding on three cases.
Here the corresponding c++ solution :
I've implemented BubbleSort algorithm in C#, to count the swaps.
OBS; this is not the best solution. O(n^2) time complexity.
'Python 3.9' Solution:
this is an awful problem