Please, how can we remove duplicate numbers in a file without using array? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please, how can we remove duplicate numbers in a file without using array?

note that getline cannot we used for numbers

21st Nov 2016, 5:06 PM
abdelpeer
abdelpeer - avatar
1 Answer
+ 1
using array is the best way. but if you Don't want to use array than here is another way. store the first number in any variable than compare it with all other numbers using loop. if match found than remove it. you have to repeat this for all numbers. NOTE!!!! this solution is not recommended... because here we need nested Loop so time complexity is n^2.
24th Nov 2016, 12:21 PM
Neel Patel
Neel Patel - avatar