+ 1

[ Interview Question ] How to remove duplicate numbers and sort those numbers from a range of input numbers?

Example : Input : 9,2,11,5,3,11,1,... Output : 1,2,3,5,9,11

22nd Jul 2021, 7:26 AM
Sagar S
Sagar S - avatar
4 ответов
+ 7
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ ,SHASHWAT MANDALI , you are showing a really nice code to help someone solving a task. we all appreciate this very much!  (this is my personal statement - but it is not to criticize someone !!) but there is an issue by giving a ready solution, when the op has not done and shown his attempt first. as a part of the community i belive that learning by doing is more helpful, than just using a shared solution. we should act more as a mentor.  it is a very successful way when we are giving hints and help, so that the op is able to solve his task by himself. it would be great if you are going to help us to keep sololearn what it is: ▪︎a unique place to learn (we are a "self" learning platform!) ▪︎an absolutely great community that is willing to help other people  ▪︎a great resource of people which has an unbelievable knowledge in coding and a long lasting experience ▪︎a place to meet people and to discuss with them all the possible points of view thanks for your understanding
22nd Jul 2021, 9:59 AM
Lothar
Lothar - avatar
+ 2
Try this 👇 It will helps to you, print(*sorted(set(int(i) for i in input().split())))
22nd Jul 2021, 7:41 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 1
Array.from(new Set(input)).sort((a,b)=>b-a);
23rd Jul 2021, 10:07 AM
Gordon
Gordon - avatar
0
Here's my try: https://code.sololearn.com/c9SSJmlORUuA I'm assuming the interviewer would want me to write a sort function, but allow other predefined functions to be used.
3rd Mar 2022, 2:44 PM
Hanz
Hanz - avatar