Set apporach is applicable for non-unique dataset also and unordered map one cannot be used for non-unique nos

just wanna confirm: unordered map approach only valid for uniques numbers did not give right output at : 1,2,2,3,4,5,6,6,7,8

hello @great

for this problem repeation will not matter.

so answer will remain same eithr u use map or set

Hey aman, I am not talking abt the problem mentioned in the video, I am talking abt the case which i mentioned in the question. The unordered map approach should logically fail in the non unique example quoted by me above

answer is 8 and the both will give 8 only.
why u think its wrong?

Hey Aman, see the two codes below
One is the implementation using unordered map by the faculty
second one containing implementation by me of the above logic and using set.
from the codes, i am getting 9 in unordered map and 8 in set (which is the correct answer). also logically if we see then unordered map code does not take into account non-uniqueness
Code1 : https://ide.codingblocks.com/s/486898 (code by faculty)
Code2 : https://ide.codingblocks.com/s/486899 (my implementation of both apporaches)

check now

Thanks a lot Aman, yes this approach i know, i was talking about the one mentioned in the video.
Btw thanks a lot for clearing the doubt

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.