Help me out in this problem


question link


my submission
it is passing 31 test cases out of 41
can you tell me why is it so?

@Aman are u there please help me out?

hello @shivammishra20121999

set allows only unique values but for median repeated values also plays an important role so use multiset and then try

@aman212yadav
i have changed but it still getting 32 test case passed
6
Output:
[8.00000,6.00000,8.00000,8.00000,2.50000]
Expected:
[8.00000,6.00000,8.00000,8.00000,5.00000]
failing in this

@aman212yadav
kindly have a look to my code

@shivammishra20121999
pls wait . . . . .

@aman212yadav
okay bro

s.erase(*vtr) will erase all the occurence of *vtr from the set which we dont want right?

to make each element unique store index along with their value in multiset.

@aman212yadav okay bro

@aman212yadav
thanks bro done

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.