Delete element in Vector

Source: Internet
Author: User
Data Structure Machine Test 1: Application of sequence table Time Limit: 1000 ms memory limit: 65536 k any questions? Click Here ^_^ In an ordered table with a length of n (n <1000), there may be "redundant" data elements with the same values (integer type ), write a program to delete "redundant" data elements from the ordered table, so that the table is composed of a "non-pure table" (elements with the same value may have multiple) to a "Pure table" (only one element with the same value can exist in the table ). The length of the input table in the first row is N;
In the second row, enter the N element values initially stored in the sequence table. Output the number of elements in the sequence table after the redundant elements are deleted in the first row;
The second row outputs the sequence table elements after deletion. Sample Input
125 2 5 3 3 4 2 5 5 4 3
Sample output
55 2 3 4 7
TIPS: use as little time as possible and the auxiliary storage space. I thought I would use a vector. I didn't expect to delete elements. (compared with list, I used to delete elements in list)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.