+ 2
Challange: Remove duplicate values from an array and make a subset of this array with all unique values?
For example, we have an array {2,5,7,5,6,1,3,2,6}. Now, make an array consisting all unique values from the given array i.e. {2,5,7,6,1,3}.
12 Answers
+ 12
My first challenge :) Short and simple.
https://code.sololearn.com/cWr98wIuYUqj/?ref=app
+ 9
And the winner is?
+ 3
Here's my C# implementation â
LINQ One-Lineră°
Console.WriteLine(string.Join(", ", new int[] { 2, 5, 7, 5, 6, 1, 3, 2, 6 }.Distinct()));
Well I think it's kinda rude here to use LINQ for this kind of challenge. Anyway, enjoy!
https://code.sololearn.com/cc2SSFeuUMr3/?ref=app
+ 3
@Empty that 1 minute though. đđ
+ 3
@Empty Really?? I just started to take up Python and let's see if I find something intersting!! đ
+ 2
For Python, I think "set" will do the trick.
+ 1
+ 1
Here you go. Checks for valid input.
https://code.sololearn.com/cB0X3ywupkru/?ref=app
+ 1
reusing challenges, I do a filter in https://code.sololearn.com/WaFXqRzaA6aw/?ref=app
+ 1
@Yash I fixed the bug, thank you for telling it
0
There are many ways to do this,the naive way is use two pointers, do loops to check every single number in array;you can also use HashSet, which is used to remove duplicate elements in the industry field.
- 1
TRY THIS BRAND NEW CHALLENGE AND GET FRESH..
https://www.sololearn.com/discuss/666260/?ref=app