Minimum operations to sort an array

Revision en1, by vaibhavmisra, 2021-11-13 06:48:57

Operation : Change any array element to arbitrary integer, O(N^2) would give TLE, My approach : ans = Length of array — Length of longest non-decreasing sub-sequence because I want maximum length already sorted, TC : O(NlgN),
Is this approach correct? Any other approaches?

Tags lis, sorting


  Rev. Lang. By When Δ Comment
en1 English vaibhavmisra 2021-11-13 06:48:57 334 Initial revision (published)