Modern computers do about simple operations per second.
Rule of thumb for 1-second limit:
- :
- :
- :
- :
- :
- :
Example: If and you need , that's operations. Should pass in well under a second.
Always check constraints first. If brute force fits, use it. Simple code has fewer bugs.