This is the problem statement.
In My solution I precalculate the sortedness between existing values and save it in global variable sum
Then I calculate the value val[i][j]
where i
represent the index of a position with missing value in the given sequence and j
represent the index of one of the missing values in vector want,
then I find the rest of sortedness values using TSP function, I used map because the state would be too big to fit in an array.
But the solution didn't pass.
Is there any other optimizations to be considered for my implementation.
Thanks.