+ 12
[ASSIGNMENT] 🔡 🔠 🎮 Remove duplicate characters from a string.
For example, Input : Bananas Output : Bans
17 Answers
+ 16
there can be multiple solutions but I think easiest one is:
define a char array b, start adding char from string , if char is already present skip.
time complexity o(n²)
+ 8
In C# LINQ
Console.WriteLine(new string("Bananas".ToCharArray().Distinct().ToArray())));
+ 7
+ 6
my code using cpp
https://code.sololearn.com/cdTZOkwMfWsu/?ref=app
+ 5
https://code.sololearn.com/c7u52cntBUgx/?ref=app
+ 3
@Aqua Post a code :-D
+ 3
Here you Can see my code https://repl.it/Gyml/6
+ 3
In python:
a = []
[a.append(i) for i in input() if not i in a]
print("".join(a))
+ 2
JavaScript
https://code.sololearn.com/WBXQ4d2OA2dR/#js
+ 1
https://code.sololearn.com/c18u1z7YuT6j/?ref=app
+ 1
in java using set interface
https://code.sololearn.com/c3kD4Z9IcLIH/?ref=app
+ 1
In PHP:
print(implode(array_unique(str_split($str))));
0
i want to learn some basic projects for js. because of i am a beginner. so which website is best to learn. demo project??
- 4
HERES A NEW CHALLENGE
CHECK IT AND TRY IF YOU WANT
https://www.sololearn.com/discuss/793924/?ref=app