79814496

Date: 2025-11-08 22:59:04
Score: 1
Natty:
Report link

Whatever the rule is, you can write a function to test it. For example, perhaps you want to know if the array contains a 5, followed by a 7, which is followed by a 9. This could be done using a few vectorized operations, such as in Numpy first occurrence of value greater than existing value. For more complicated rules, you'll have to loop through the numbers in the array, using the same kinds of logic used in regex matching. For example, maybe you want to test if a row has a 5 followed by a 7 followed by a 9, with only negative numbers between the 5 and the 7. I don't think that can be done without a loop.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: David Wasserman