Remove Duplicated Characters In Given String

In a given string, the following code removes duplicated characters within O(n) time and does not increase memory space:

Sourcecode is here. Many thanks to Xuan, Yinghai and Shiqi.

8 Responses to “Remove Duplicated Characters In Given String”

  1. CAO Shiqi Says:

    try “aba”

  2. Yu Wang Says:

    wangy22@linux ~/code/C $ ./CheckDup
    aba
    aba

  3. CAO Shiqi Says:

    what is the specification of the the code?

  4. Yu Wang Says:

    Remove duplicated characters in given string,
    not reduce same characters to 1 character.

  5. CAO Shiqi Says:

    in string “aba”, “a’ is duplicated, right?

  6. Yu Wang Says:

    In “aab”, ‘a’ is.

  7. RaKesh Says:

    Try “Potato”

  8. pmouse Says:

    # Yu Wang Says:
    March 28th, 2006 at 9:18 am

    In “aab”, ‘a’ is.

    this is such a trivial problem then…=.=

Leave a Reply


Chat with me. =)