For loop in last function not being executed

I made a function to check whether a given string was already present in the vector or not. But I don’t know why the last for loop is not being executed.

Here’s my code

Hey @Doctor_Insult
In line 38, you have made a new vector which is empty and you’re checking if string is available in empty vector. So the function is working but the vector sent is wrong.

If your doubt is resolved please mark it as closed.

I sort of get what you are trying to say, and I made an appropriate change in the last function. https://ide.codingblocks.com/s/192317

But what I am not understanding is when I input 25, why is palak getting printed twice even though I have checked for duplicates?

@Doctor_Insult
Your code never sent the correct vector. How will it then check for duplicates ?

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.