I was asked to write a program to eliminate the reoccurrence of numbers in an interview? For example if I give the input as 2233555697 then the output should be 235697
Recommended Answers
Jump to PostUse this logic..
Sorry this code is in python not in c...but you can understand the logicnumber = 123134254 reverse = 0 while number > 0: reverse = (reverse * 10) + (number % 10) number /= 10 b = 0 answer = 0 while reverse …
Jump to Post"without arrays/stacks/queues" makes this a lot more interesting - presumably that bans dictionaries as well?
You could use a nested loop like (pseudocode)
for i = 0 to string length for j = i+1 to string length if char j == char i, remove char j
All 6 Replies
Moschops 683 Practically a Master Poster Featured Poster
Mayukh_1 0 Light Poster
aravindm 1 Newbie Poster
Mayukh_1 0 Light Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
Mayukh_1 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.