Doof on Cartesian

I had this solution which resulted in WA but then I just changed my vector to array and it worked what’s the reason behind this!!
Please explain.

Try printing the n’th item in an array of n size or vector of n size , it gives random output, that random may have matched with b variable of yours giving output -1 instead of n

Congo, your vector solution got accepted

Just edited this portion

    if(l1!=n && v[l1]==b)

There is already a discussion going on this topic

1 Like