Jun-13-2019, 04:47 PM
Do the values following the first -1 always equal -1 or can they vary? For example:
25 30 22 87 -1 -1 # Always -1 25 30 22 87 -1 6 # Not always -1If it's the former, you can use filter to find all values that do not equal -1 and then use len() on the result. Otherwise, I'm not sure you'll be able to avoid a loop.