Ok…so, once we have the x = the leftmost point not covered, then we see all those points coveering x and having k maximum,…and then update x=k+1
but then again we will have to see traverse all the points again…this will take O(N^2).Am i right…correct me plz, if i am!
There is no need for an array. Initially, set the first uncovered point to the left endpoint of the segment you want to cover. Then, as described in the editorial, if k is the furthest right endpoint of a segment covering x, then set next x (the next point to be covered) to k+1.
It is impossible that you tried all test cases.