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.
The range elimation is based on the vector after the element elimination.
For example, in the sample input:
6
1 4 6 2 8 9
2
2 4
The first elimination is to erase the 2nd element in the vector, which is 4. Then, based on the new vector {1 6 2 8 9}, we want to remove the range of 2~4, which means the 2nd and 3rd elements should be removed. Then 6 and 2 in the new vector are removed and we finally got {1 8 9} as the final result...
Hope the above help those who did not get what the problem asks us to code...
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Vector-Erase
You are viewing a single comment's thread. Return to all comments →
I think the problem description is not clear...
The range elimation is based on the vector after the element elimination.
For example, in the sample input:
6
1 4 6 2 8 9
2
2 4
The first elimination is to erase the 2nd element in the vector, which is 4. Then, based on the new vector {1 6 2 8 9}, we want to remove the range of 2~4, which means the 2nd and 3rd elements should be removed. Then 6 and 2 in the new vector are removed and we finally got {1 8 9} as the final result...
Hope the above help those who did not get what the problem asks us to code...