I don't know what's wrong in this if statement?

if array[0] have all array[1] letters then return false

Can you expand on describing the logic? How does this loop work? What condition causes it to return false?

Also, are you sure that it is supposed to return false if the letters are all present?

1 Like

Nope , actually I’m very confused after watching some content of solution 1

I don’t want to watch whole solution without tryin’ anything

but I truly appreciate your efforts

it’s failing because it doesn’t do what you want
when the elemeny is not present you get -1 which is truthy, when the element is present you can get 0 which is falsy or a positive number which is truthy
the behaviour is not consistent


ohh that’s why the condition needs to be < 0 , bcz 0 < 0 is always false