6 Answers
New Answer1. Sort the array in ascending order. 2. Remove duplicate values. 3. Get the k-th element from the array.
Ipang , l = [3,5,3,1,2,4,5] l2 = list(set(l)) and then sorting and then getting k-th element
Shadoff, Yes that is the right way in Python. I guess things are different by language. In C++ std::unique() works best with sorted collections. So maybe implementation differ by language : )
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message