004 string deduplication (keep it up), 004 keep

Source: Internet
Author: User

004 string deduplication (keep it up), 004 keep

Design algorithms and write code to remove repeated characters in strings. No extra cache space is available. Note: one or two additional variables can be used, but an additional array copy is not allowed.

Simple question:

#include <stdio.h>#include <string.h>void remove_duplicate(char vStr[]){int Len = strlen(vStr);if (!Len) {printf("the string is NULL\n");return ;}    int Count = 0;for (int i=0; i<Len; ++i){if (vStr[i] != '\0'){vStr[Count++] = vStr[i];for (int k=i+1; k<Len; ++k){if (vStr[i] == vStr[k]){vStr[k] = '\0';}}}}vStr[Count] = '\0';}void remove_duplicate2(char vStr[]){int Len = strlen(vStr);if (!Len) {printf("the string is NULL\n");return ;}bool Visited[256];memset(Visited, 0, sizeof(Visited));int Count = 0;for (int i=0; i<Len; ++i){if (!Visited[vStr[i]]){vStr[Count++] = vStr[i];Visited[vStr[i]] = true;}}vStr[Count] = '\0';}void test(){char Str[] = "13434343435568889hhhhhhhfdcvbb";remove_duplicate(Str);printf("%s\n", Str);}

Keep it up writes several algorithm questions every week, entertainment!


What is keep it up?

Keep up
Persistence; maintenance; continue; Do not low; do not bend (disease, etc.); [brush] use upper-case Layout
Keep up
Keep up with and keep up with each other.
Keep in touch...

Phrases Related to keep:
Earn one's keep
Earning money to maintain life
Worthy of employment; worthy of support
For keeps
[Beautiful region] Last place; always; earnestly; always occupied
In bad keep
Poor storage
In low keep
Poor storage
In good keep
Saved
In high keep
Saved
Keepabreast (of,)
Keep up...
Keep after
Keep catching up and tracking
Constantly speaking, repeatedly speaking
Keep ahead ()
Keep the leading position (...)
Keep
(= Keep on at) tangle (someone)
(= Keep sb. at…) force someone to keep doing something
Persistently do (something)
Keep at it
[Port] refuel and work hard. Don't relax!
Keep away
Leave and avoid
Keep back
Retreat; conceal; stay under [buckle]; Block
Keep clear
Escape
Keep down
Squat down; control; stop growth; reduce; print with small words; make (food, medicine, etc.) not spit out
Keep from
Avoidance; prohibited; concealed; restrained
Keep going
Continue
Continue
Keep in
Hold; suppress; conceal; make (fire) not extinguish; make (some) State
Keep in with sb.
Get along with others.
Keep indoors
Stay at home, do not go out
Keep it up
Continue as it is
Keep off
Avoid; do not (LET) approach; prevent; (rain and snow) No
Keep on
Continue; wear [wear]
Continue, stick to it
Continue to hire (someone)
(Used with about) continue
Keep on
Endless; keep complaining (someone)
Keep on
Continue (do something)
Keep to oneself
Do not interact with people, and stay alone
Keep out
Keep the... out of the room; stop the entry; do not participate; do not go in; [Click to clean]
Keep out
Outside of..., so as not to participate in the pre-or not involved
Keep sb. advised in Fig.
Let someone know the progress of something at any time
Keep sb. going in.
Continue to supply something to someone
Keep… to oneself
Keep a secret and never tell others
Keep sb. underfoot
Control someone; keep someone under your feet for a long time; keep someone subordinate for a long time
Keep
Persistence; non-violation (promise, plan, etc)
Don't leave..., stay...
Keep together
(Make) not dispersed
(Enable) Action Coordination
Keep under
Control and hold down
Oppression
Make it under anesthesia... full text>
 
What is keep it up?

Meaning of "persistence"

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.