A bit doubt in code!


#1

if(s==1)m=i+1;
else if(um.find(s)==um.end()){ // rather than if(um.find(s)==um.end())
um[s]=i;
}
If I add this it shows correct answer but it doesn’t save m[1] as I think we should save that position too but i’m unable to find it’s correct or incorrect!! Please help me on this?