sir can u tell what is wronng in code it is giving wrong answer for all test cases but i cant figure out what is wrong link is https://ide.codingblocks.com/s/111918
Exit or not doubt
Take a map, instead of set, map<int,bool> mapp; and then modify your code accordingly,
but what is wrong with this approach i am not getting it ,can u give me example test cases
Your code is producing results for only 1 test case. If you wish to see output for more than one test case, it is not showing that.