m[pre]=i;
should be in the if statement but not “else”
since it can be used in later calculations but if not stored at that time it could not be taken into consideration later.
So if it is not already there it should be added
by the condition
if(m.find(pre)==m.end())
{
m[pre]=i;
}
this
Doubt in one line of code
hi @himanshuanand729, same thing.
here bhaiya has used != so he wrote in else
u wann use == so u write in if
I wanted to say regardless of other if’s before this should be evaluated in all the cases.
if there we write else it means we are saying just above if condition is not followed then it should execute.
I am saying regardless of that this should be checked.
is there any problem in my interpretation…as I think else statement will leave some case i.e. why I wrote other if
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.