What am i doing wrong
i dont know its saying wrong answers for all test cases on submitting…but gives correct ans. custom test case
@abhigyanprakash29 i think your apprach is wrong because we hvae to print those elements whose frequency is zero only but your code’s logic is that if the element has frequncy greater then 1 then it should be printed. you are missing cases when a element can have a frequency of greater then 2 as well.
Here is the correct code for your reference:
if you have any doubt you can ask here:
Happy Learning!!
Given an array of integers, 1 ≤ arr[i] ≤ n (n = size of array), some elements appear twice and others appear once.
Find all the elements that appear twice in this array.
__ Answer must be sorted
no i guess it because the ans. should be sorted…
Thanks for sharing the question but yes if it is given that at max elements can be in a frequency of 2 only then sorted output is the only wrong thing you were doing.
yes thanks…btw in which are you currently studying
Hello @abhigyanprakash29 if you feel that your doubt is cleared you can mark this as resolved.
Happy Learning!!
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.