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.
First: number cannot move more than 2 places forward.
Second: Calculating difference between original positions and current posistions is not enough. (Sample test 1)
Third: For every element you need to check, how many bigger elements are in front of them and that is enough.
Third*: But simply iterating through the list of 'already reviewed' items is too slow.
Fourth: Combining points First and Third you can come up with a correct answer.
I will paste incorrect code that is too slow to finish the task.
That is what I meant by point Third*.
New Year Chaos
You are viewing a single comment's thread. Return to all comments →
A difficult one to me. It took me a lot of time.
First: number cannot move more than 2 places forward. Second: Calculating difference between original positions and current posistions is not enough. (Sample test 1) Third: For every element you need to check, how many bigger elements are in front of them and that is enough. Third*: But simply iterating through the list of 'already reviewed' items is too slow. Fourth: Combining points First and Third you can come up with a correct answer.
I will paste incorrect code that is too slow to finish the task. That is what I meant by point Third*.