Please check my code it is shwoing compliation error
Error area is Find method
Please check my code it is shwoing compliation error
Error area is Find method
if(m.find(n-i)!=m.end()){
swap(m[i],m[(m.find(n-i))->first]);
you have to add this condition before swapping
but it is necessary?
because i will always find that element in the quesiton i am doing
it is always better to check before using find function
because in some case it may not found
can you please tell whats wrong with the code its still giving wrong answer
look at this modified Code
in your code you have make m.first as index and m.second as value
but during find funtion it will search index not value